laiguCollisionFormDoctrinePlugin - 1.0.2

Easy way to detect collisions when two or more people are editing same data in a form.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source

laiguCollisionFormDoctrine plugin


laiguCollisionFormDoctrine provides an easy way to detect collisions when two or more people are editing same data in a form. Our plugin add collision detection to all your forms in one simple step.

How it works

This plugin adds to your forms a hidden input field with string that contains a hash made with the data that is in the form. When the form is saved, the plugin retrieves the original data object from database, hashes its data, and compares it with the hash stored in the form hidden field. If this two hashes are not equal an error is raised alerting the user that someone has edited same data while editing it. An override option is provided by clicking save for a second time.


  • Download and install the plugin

    ./symfony plugin:install laiguCollisionFormDoctrinePlugin --stability=beta
  • Clear the cache

    ./symfony cc


  • Enable the plugin laiguCollisionFormDoctrinePlugin on a project, via /config/ProjectConfiguration.class.php:

      class ProjectConfiguration extends sfProjectConfiguration
        public function setup()
          $this->enablePlugins('sfDoctrinePlugin', 'laiguCollisionFormDoctrinePlugin');
  • Edit file /lib/form/BaseFormDoctrine.class.php and change 'sfFormDoctrine' by 'laiguCollisionFormDoctrine':

      abstract class BaseFormDoctrine extends laiguCollisionFormDoctrine
        public function setup()
          // if you want to change default work mode
          // if you want to personalize the error message uncomment the follow line (optional)
          //$this->error_msg_laiguCollision = 'Los datos han sido modificados mientras estaba editando. Si guarda ahora, sus modificaciones sobreescribiran todo.';
          //$this->error_msg_reload_laiguCollision = 'Los datos han sido modificados mientras estaba editando. Tus modificaciones se han perdidos ya que se han recargado los datos de la base de datos.';

That's it!.


  • Jordi Llonch ( jordi [at] laigu [dot] net ), []
  • Magí Carbonell ( mcarbonell [at] laigu [dot] net ), []


  • vesrion 1.0.2: added new work mode: when collision exists, reload data from object
  • version 1.0.1: changed funcion name disableCollisionDetection
  • version 1.0.0: stable release added method to disable collision detection
  • version 0.9.0: initial release