Created
May 6, 2011 14:17
-
-
Save johnwards/959029 to your computer and use it in GitHub Desktop.
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 characters
<?php | |
use Symfony\Component\Validator\Mapping\ClassMetadata; | |
use Symfony\Component\Validator\Constraints\NotBlank; | |
class Stub | |
{ | |
protected static $data = array(); | |
public function setData($data) | |
{ | |
self::$data = $data; | |
} | |
public function __get($var) | |
{ | |
return self::$data[$var]->getTmpClientValue(); | |
} | |
public function __set($var, $val) | |
{ | |
return self::$data[$var]->setTmpClientValue($val); | |
} | |
public static function loadValidatorMetadata(ClassMetadata $metadata) | |
{ | |
foreach(self::$data as $id=>$element) | |
{ | |
$metadata->addPropertyConstraint($id, new NotBlank()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment