Created
January 22, 2012 21:53
-
-
Save Vp3n/1659036 to your computer and use it in GitHub Desktop.
Validation conditionnelle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
{ | |
public function configure() | |
{ | |
$this->validatorSchema['A1']->setOption('required', false); | |
$this->validatorSchema['A2']->setOption('required', false); | |
} | |
public function doBind(array $values) | |
{ | |
if(array_key_exists('A2', $values) && $values['A2']) | |
{ | |
$this->validatorSchema['A1']->setOption('required', true); | |
} | |
parent::doBind($values); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment