Download the PHP package madmis/activity-log-bundle without Composer
On this page you can find all versions of the php package madmis/activity-log-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package activity-log-bundle
Symfony ActivityLog Component
ActivityLogBundle - Extended doctrine loggable (StofDoctrineExtensionsBundle)
What's inside
ActivityLogBundle uses Loggable extension from StofDoctrineExtensionsBundle and DoctrineExtensions
This bundle extend Gedmo\Loggable\Entity\MappedSuperclass\AbstractLogEntry with below fields:
- parentId - store depedency to "main entity"
- parentClass - store "main entity" type
- oldData - data that were changed
- name - entry name (to show in activity log)
- user - associations mapping with user who changed data
Bundle contain extended listener (LoggableListener) to process above fields.
Also available formatter to preprocessing activity log before show in view (html).
Installation
Pretty simple with Composer, run:
Then enable the bundle in the kernel:
Configure bundle:
Create entity and make it loggable:
StringableInterface required to save LogEntry::name.
Then run command to update database schema:
Using formatter to data view
Formatter class: ActivityLogBundle\Service\ActivityLog\ActivityLogFormatter Formatter service: activity_log.formatter
required: LoggerInterface as dependency
By default entity without custom formatter class formatted by ActivityLogBundle\Service\ActivityLog\EntityFormatter\UniversalFormatter
But you can implement custom formatter for each entity.
To register a custom formatter, add a service tag with the following (required) properties:
- name: 'activity_log.formatter'
- entity: Class name of the entity that should be formatted by the registered formatter
Example:
As example formatter for AppBundle\Entity\Project entity:
If entity has association with other entity it can be resolved by AbstractFormatter::normalizeValue. This method call method from the entity formatter class, which named as appropriate property.
For example, Project entity has association mapping ManyToOne to Type entity. To get Type name we can add method type to Project formatter:
As result we have formatted response to show in view.
Using activity log in controller
For should be configured Entity formatter.