ohFormErrorLogger plugin
Overview
This plugin will automatically log all your form validation errors into your doctrine database
Installation
1.Download and install the plugin
./symfony plugin:install ohFormErrorLogger --stability=beta
2.Clear the cache
./symfony cc
3.Generate your migrations:
./symfony doctrine:generate-migrations-diff
4.Check the generated migration in the lib/migrations folder
5.Build the classes and migrate
./symfony doctrine:build --all-classes --and-migrate
How to use it
Update your ProjectConfiguration::setup() method in sf_root_dir/config/ProjectConfiguration.class.php with the following
$this->getEventDispatcher()->connect(
'form.validation_error',
array('ohFormErrorValidatorListener', 'listenToValidationError')
);
or if you only want to enable it for the frontend app, put it in the frontendConfiguration:setup()
in sf_root_dir/apps/frontend/config/frontendConfiguration.class.php
and that's it!
Warning
This may store plain text passwords in your database so only use in a development environment!
Admin generator
If you like you can generate an admin module for your errors
./symfony doctrine:generate-admin backend ValidationError
todo
Write tests
Handle global errors differently
Write functionality to turn off for certain validators (eg password)
Include a better admin generated module