Last active
December 15, 2015 04:59
Revisions
-
Mihailoff renamed this gist
Mar 20, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Mihailoff renamed this gist
Mar 20, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Mihailoff revised this gist
Mar 20, 2013 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,16 +7,16 @@ ) ); $rules = new Symfony\Component\Validator\Constraints\Collection(array( 'fields' => array( 'agency' => array( new Symfony\Component\Validator\Constraints\Collection(array( 'fields' => array( 'name' => array( new Symfony\Component\Validator\Constraints\NotBlank() ), 'moderator' => array( new Symfony\Component\Validator\Constraints\NotBlank() ), ) )) @@ -25,5 +25,7 @@ )); // @see http://api.symfony.com/2.1/Symfony/Component/Validator/ConstraintViolationList.html $violationList = $container->get('validator')->validateValue($data, $rules); if (count($violationList)) echo $violationList; // gracefully casts to string -
Mihailoff created this gist
Mar 20, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ <?php $data = array( 'agency' => array( 'name' => 'a', 'moderator' => 'b' ) ); $rules = new Constraints\Collection(array( 'fields' => array( 'agency' => array( new Constraints\Collection(array( 'fields' => array( 'name' => array( new Constraints\NotBlank() ), 'moderator' => array( new Constraints\NotBlank() ), ) )) ) ) )); // @see http://api.symfony.com/2.1/Symfony/Component/Validator/ConstraintViolationList.html $constraintViolationList = $this->container->get('validator')->validateValue($data, $rules); count($constraintViolationList);