SonataAdminBundle: Audit entity compare not working
Environment
Sonata packages
$ composer show sonata-project/*
sonata-project/admin-bundle 3.3.2 The missing Symfony Admin Generator
sonata-project/block-bundle 3.0.1 Symfony SonataBlockBundle
sonata-project/cache 1.0.7 Cache library
sonata-project/core-bundle 3.0.3 Symfony SonataCoreBundle
sonata-project/doctrine-orm-admin-bundle 3.0.4 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter 1.5.0 Lightweight Exporter library
Symfony packages
$ composer show symfony/*
symfony/assetic-bundle v2.8.0 Integrates Assetic into Symfony2
symfony/monolog-bundle 2.11.1 Symfony MonologBundle
symfony/phpunit-bridge v3.1.1 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.2.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu v1.2.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.2.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.2.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.2.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.2.0 Symfony utilities for portability of PHP codes
symfony/security-acl v3.0.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony v3.1.1 The Symfony PHP framework
PHP version
$ php -v
PHP 7.0.8-3+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
with blackfire v1.10.4, https://blackfire.io, by Blackfireio Inc.
Subject
I’ve enable orm entity audit following docs but when I try to compare revisions it shows only the entity without the compared entity and highlighted fields.
Digging into why I’ve found that it’s no possible to extend a block provided from a macro. Look at this issue at Stackoverflow.
CRUDController:historyCompareRevisionsAction
renders SonataAdminBundle:CRUD:base_show_compare.html
that extends SonataAdminBundle:CRUD:base_show.html.twig
and this imports macro SonataAdminBundle:CRUD:base_show_macro.html.twig
with blocks show_field
and show_title
thats base_show_compare
try to override but nothing happens. So compare action only shows the entity.
To test this I’ve pasted code from base_show_macro
into base_show
making necessary adjusts and compare action works great, highlighting with read modified fields.
I hope I made the flow clear.
Steps to reproduce
Enable audit and try to compare revisions. It will show only the entity without compared entity.
Expected results
Show 2 entities and highlighted fields.
Actual results
Show only the revision.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (17 by maintainers)
As I added a reaction, I found it and emailed him. Thanks for the patient @greg0ire
Just clone the whole repo and type
git show 5633138
then…