public function __call($method, $arguments) { if ($method == 'setId') { return $this->set('id', Guid::generateId()); } else { return parent::__call($method, $arguments); } }
public function configure() { $permissions = Doctrine_Core::getTable('sfGuardPermission')->findAll(); $choices = array(); foreach ($permissions as $permission) { $choices[$permission->getId()] = $permission->getName(); } $this->setWidget('permissions', new sfWidgetFormSelectRadio(array('choices' => $choices))); $this->setValidator('permissions', new sfValidatorChoice(array('choices' => array_keys($choices)))); $this->setValidator('id', new sfValidatorString(array('max_length' => 255, 'required' => false))); $this->setDefault('id', Guid::generateId()); $this->setWidget('exposition_list', new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'Exposition', 'renderer_class' => 'sfWidgetFormSelectDoubleList'))); $this->getWidget('exposition_list')->setOption('renderer_options', array('label_unassociated' => 'Disponibles', 'label_associated' => 'Séléctionnés')); $this->getWidgetSchema()->moveField('exposition_list', sfWidgetFormSchema::AFTER, 'permissions'); unset($this['updated_at'], $this['created_at'], $this['last_login'], $this['groups_list'], $this['permissions_list'], $this['is_super_admin'], $this['algorithm'], $this['salt'], $this['is_tosync']); }