Dynamic rule validation persistence between validator calls <p>I've came across this problem a few times, but could never find a solution, only work arounds.</p> <p>Lets say I have multiple 10 jobs, but depending on the answers given the validation rules are different.</p> <pre><code>foreach($jobs as $job){ if(!$this-&gt;Job-&gt;validates()){ echo 'Oh no, it didn't validate'; } } </code></pre> <p>The main problem I'm finding is if I set a rule that was triggered only by the first job.</p> <pre><code>if($this-&gt;data['Job']['type'] == 'special'){ $this-&gt;validator()-&gt;add('special_field', 'notEmpty', array( 'rule' =&gt; array('notEmpty'), 'message' =&gt; 'Please provide data' )); } </code></pre> <p>It would also apply to the other 9. So the rules are persistent between calls. So can could remove the rule if it exists.</p> <pre><code>if($this-&gt;data['Job']['type'] == 'special'){ $this-&gt;validator()-&gt;add('special_field', 'notEmpty', array( 'rule' =&gt; array('notEmpty'), 'message' =&gt; 'Please provide data' )); }else{ $this-&gt;validator()-&gt;remove('special_field', 'notEmpty'); } </code></pre> <p>But if the rule doesn't exist when it tries to remove it a Fatal Error is thrown.</p> <p>Is there any way to check a rule exists before I remove it or a way to clear dynamic rules at the start of beforeValidate?</p>