Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Check for existing notEmpty validator only in the first position of v…
Browse files Browse the repository at this point in the history
…alidator list
  • Loading branch information
cgmartin committed Aug 20, 2012
1 parent 25e5631 commit a468a46
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,13 @@ protected function injectNotEmptyValidator()
}
$chain = $this->getValidatorChain();

// Check if NotEmpty validator is already in chain
// Check if NotEmpty validator is already first in chain
$validators = $chain->getValidators();
foreach ($validators as $validatorInfo) {
if (isset($validatorInfo['instance'])
&& $validatorInfo['instance'] instanceof NotEmpty
) {
$this->notEmptyValidator = true;
return;
}
if (isset($validators[0]['instance'])
&& $validators[0]['instance'] instanceof NotEmpty
) {
$this->notEmptyValidator = true;
return;
}

$chain->prependByName('NotEmpty', array(), true);
Expand Down

0 comments on commit a468a46

Please # to comment.