upPropelLockTableBehaviorPlugin - 1.0.0

The upPropelLockTableBehaviorPlugin add methods on Propel objects to set locks.

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



  • Any Propel object can be locked


  • Install the plugin :
php symfony plugin:install upPropelLockTableBehaviorPlugin
  • You must have a field into the session to identify an user

  • Enable the plugin for each Propel object you want. For example, at the end of lib/model/User.php, add this line :

sfPropelBehavior::add('User', array('locktable'=>array('session'=>'id')));
  • The session parameter is the name of the session field used to identify the user


Lock an object with the current user :


Check if an object is locked :


Remove every lock for an user :


You can use this plugin with the form framework, for example, by editing BaseFormPropel :

public function setup()
  $class = get_class($this->getObject());

  if ($class) {
    // Since getLocks is a dynamic method, we can't use
    // get_class_methods to check if it does exist.
    // Instead, we can use a try/catch.
    try {
      if ($this->getObject()->getLocks()) {
        foreach ($this->widgetSchema->getFields() as $field) {
          $field->setAttribute('disabled', true);
      } else {
    } catch (sfException $e) {}


upPropelLockTableBehaviorPlugin has been developped by Leo Cacheux for Devoteam/Uperto. It has been released under the MIT license.