-
Notifications
You must be signed in to change notification settings - Fork 3
Audit Object Manager
Because zf-doctrine-audit requires it's own Object Manager the first step for installation is creating second object manager. A good guide for doing this is found at blog.tomhanderson.com.
Your second object manager may exist on the same database as your target entities. Because the entities it is responsible for are not on the default object manager both may exist and flush independently. Optionally you may have a separate database or host for zf-doctrine-audit.
See Configuration for more information on the other configuration options.
The tools provided by doctrine/doctrine-orm-module
work only on the default object manager so zf-doctrine-audit
has it's own schema-tool. Before continuing your target object manager database must have all the tables in the schema in the database.
This command will dump the schema diff for the audit object manager. It does not act directly on the database.
php index.php zf-doctrine-audit:schema-tool:update
If you are comfortable with the schema this tool creates, then run it on your audit database:
php index.php zf-doctrine-audit:schema-tool:update > audit_schema.sql
mysql -u audit -p123 audit < audit_schema.sql
zf-doctrine-audit has four fixture tables which store information about the target and audit databases. Before you start auditing you must create your fixtures. This command does act directly on the audit database.
php index.php zf-doctrine-audit:data-fixture:import
If you make a mistake in the process outlined on this page just drop your audit database, recreate, and start again. None of the steps here act on your target database.
zf-doctrine-audit © 2016 API Skeletons. Released under the MIT license.