public function bind(array $taintedValues = null, array $taintedFiles = null) { for ($idx = 1; $idx <= 5; $idx++) { $this->validatorSchema["enlace_n{$idx}"]['url'] = new sfVoValidatorUrl(array('required' => false), sfVoForm::getUrlMessages()); $this->validatorSchema["enlace_n{$idx}"]['culture'] = new sfValidatorString(array('required' => false)); if (is_null($taintedValues["enlace_n{$idx}"]['url'])) { unset($this->embeddedForms["enlace_n{$idx}"], $taintedValues["enlace_n{$idx}"]); } else { $enlace = $this->embeddedForms["enlace_n{$idx}"]->getObject(); $taintedValues["enlace_n{$idx}"]['culture'] = sfContext::getInstance()->getUser()->getCulture(); } } parent::bind($taintedValues, $taintedFiles); }
public function bind(array $taintedValues = null, array $taintedFiles = null) { $taintedValues['sf_guard_user_id'] = sfContext::getInstance()->getUser()->getGuardUser()->getId(); for ($idx = 1; $idx <= 5; $idx++) { if (is_null($taintedValues["enlace_n{$idx}"]['url'])) { unset($this->embeddedForms["enlace_n{$idx}"], $taintedValues["enlace_n{$idx}"]); $this->validatorSchema["enlace_n{$idx}"]['url'] = new sfValidatorUrl(array('required' => false)); } else { $this->validatorSchema["enlace_n{$idx}"]['url'] = new sfVoValidatorUrl(array('required' => false), sfVoForm::getUrlMessages()); $this->embeddedForms["enlace_n{$idx}"]->getObject()->setPropuesta($this->getObject()); } } parent::bind($taintedValues, $taintedFiles); }
public function bind(array $taintedValues = null, array $taintedFiles = null, $img = false) { // remove the embedded new form if the name field was not provided $taintedValues['vanity'] = SfVoUtil::fixVanityChars($taintedValues['vanity']); for ($idx = 1; $idx <= 5; $idx++) { if (is_null($taintedValues["enlace_n{$idx}"]['url'])) { unset($this->embeddedForms["enlace_n{$idx}"], $taintedValues["enlace_n{$idx}"]); $this->validatorSchema["enlace_n{$idx}"]['url'] = new sfValidatorUrl(array('required' => false)); } else { $this->validatorSchema["enlace_n{$idx}"]['url'] = new sfVoValidatorUrl(array('required' => false), sfVoForm::getUrlMessages()); $this->embeddedForms["enlace_n{$idx}"]->getObject()->setSfGuardUser($this->getObject()); } } // call parent bind method parent::bind($taintedValues, $taintedFiles); }