baskin / history-bundle
Twig Extension for Gedmo Loggable
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 2 792
Dependents: 2
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Type:symfony-bundle
Requires
- php: >=5.5.9
- doctrine/orm: ~2.3
- stof/doctrine-extensions-bundle: ~1.1
- symfony/dependency-injection: ~2.1|~3.0
- symfony/doctrine-bridge: ~2.2|~3.0
- twig/extensions: ~1.0
- twig/twig: ~1.0
Suggests
- sensio/framework-extra-bundle: ~2.2|~3.0
This package is not auto-updated.
Last update: 2024-01-20 14:48:49 UTC
README
Twig Extension for DoctrineExtensions Loggable. StofDoctrineExtensionsBundle allows to easily use DoctrineExtensions in your Symfony project by configuring it through a ListenerManager and the DIC.
Setting up the bundle
Add BaskinHistoryBundle to your project
composer require baskin/history-bundle
Enable the Bundle
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Baskin\HistoryBundle\BaskinHistoryBundle(), ); }
Configuration Reference
Below is the full default configuration for the bundle:
# app/config/config.yml baskin_history: revert: false # change if you want to revert function versionParameter: version # Query parameter for revert function ex: /route?version=12 template: BaskinHistoryBundle:History:history.html.twig #history log template
The reference can be dumped using the following command: php app/console config:dump-reference BaskinHistoryBundle
Usage
Simple twig function with your loggable entity parameter.
{{ getLogs(entity) }}
Revert Function Usage
Firstly revert
configuration must be enabled. And use reverter
service revert
method on controller method.`
$entity = $em->getRepository('AppBundle:YourEntity')->find($id); $this->get('reverter')->revert($entity);
Usage with SensioFrameworkExtraBundle ParamConverter
Basically it is automatically convert your entity. If you want to disable you must set revertable options to false.
/** * @ParamConverter("yourEntity", options={"revertable" = false}) */ public function showAction(YourEntity $yourEntity) { ... }
Note : If you don't want to show Show this version
button set second parameter false {{ getLogs(entity, false) }}