/** * constructor * * @param array $forms An array with forms to embed into this one * @param string $formClass The classname of the sfFormDoctrine forms **/ public function __construct($forms = array(), $formClass = null, $options = array(), $CSRFSecret = null) { $this->formClass = $formClass; parent::__construct(array(), $options, $CSRFSecret); foreach ($forms as $name => $form) { $this->embedForm($name, $form); } }
/** * Constructor. * * @param mixed A object used to initialize default values * @param array An array of options * @param string A CSRF secret (false to disable CSRF protection, null to use the global CSRF secret) * * @see sfForm */ public function __construct($object = null, $options = array(), $CSRFSecret = null) { $class = $this->getModelName(); if (!$object) { $this->object = new $class(); } else { if (!$object instanceof $class) { throw new sfException(sprintf('The "%s" form only accepts a "%s" object.', get_class($this), $class)); } $this->object = $object; $this->isNew = !$this->getObject()->exists(); } parent::__construct(array(), $options, $CSRFSecret); $this->updateDefaultsFromObject(); }
/** * Constructor. * * @param BaseObject A Doctrine object used to initialize default values * @param array An array of options * @param string A CSRF secret (false to disable CSRF protection, null to use the global CSRF secret) * * @see sfForm */ public function __construct(\Doctrine\ORM\EntityManager $em, $object = null, $options = array(), $CSRFSecret = null) { $this->em = $em; $class = $this->getModelName(); if ($object) { if (!$object instanceof $class) { throw new sfException(sprintf('The "%s" form only accepts a "%s" object.', get_class($this), $class)); } $this->object = $object; } else { $this->isNew = true; $this->object = new $class(); } parent::__construct(array(), $options, $CSRFSecret); $this->updateDefaultsFromObject(); }