* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * @Annotation * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) * * @author Bernhard Schussek */ class Collection extends Composite { const MISSING_FIELD_ERROR = '2fa2158c-2a7f-484b-98aa-975522539ff8'; const NO_SUCH_FIELD_ERROR = '7703c766-b5d5-4cef-ace7-ae0dd82304e9'; protected static $errorNames = array( self::MISSING_FIELD_ERROR => 'MISSING_FIELD_ERROR', self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR', ); public $fields = array(); public $allowExtraFields = false; public $allowMissingFields = false; public $extraFieldsMessage = 'This field was not expected.'; public $missingFieldsMessage = 'This field is missing.'; /** * {@inheritdoc} */ public function __construct($options = null) { // no known options set? $options is the fields array if (is_array($options) && !array_intersect(array_keys($options), array('groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'))) { $options = array('fields' => $options); } parent::__construct($options); } /** * {@inheritdoc} */ protected function initializeNestedConstraints() { parent::initializeNestedConstraints(); if (!is_array($this->fields)) { throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s', __CLASS__)); } foreach ($this->fields as $fieldName => $field) { // the XmlFileLoader and YamlFileLoader pass the field Optional // and Required constraint as an array with exactly one element if (is_array($field) && 1 == count($field)) { $this->fields[$fieldName] = $field = $field[0]; } if (!$field instanceof Optional && !$field instanceof Required) { $this->fields[$fieldName] = $field = new Required($field); } } } public function getRequiredOptions() { return array('fields'); } protected function getCompositeOption() { return 'fields'; } } __halt_compiler();----SIGNATURE:----a7fDlR0kY7wEBT+hg4Uixd6Fk6sa11hYpyYqyPy8ZOz3cUa9MkxzIqm/9jb16b61OrO33Otszyh40Y3kGSZ5SaIH46u9xtcfq30TRNuWOuaArWwF+HH3R1tOHYX6XKX3kQFB8AzXb8yVkcBj7zZE2ggR4TI/TSiWt04wFT52LgfIVbTmDzIlgtOUcHM0MpwMaUWZ3bQzBXLGGIPLb5REN0VTsJeeXuFMhfO6/ewkUKn5gCo828PQvKVECS1Tn3sfN+3O54X4OVStxM/ANOg/3w5PK+ZXKZViuAduhkcdqCqzoRZAJR4UgPFL1nzuGmA2O1a5ocBQqicd4OHb0cmxM+PJ/dK43RTuib2R+nUocBmc3WfevmRAxR8rvwst0/UjEOKN+O6HIgGe/Pe+cHQtIjXiCRevM+frdb9EQYWk8VLRY6Jr8guNVZf4MxULabkFzHeAMGirTVujpHwfOYc+E4Ket9IlHZMu8bFPZ9ckjJvrkBSakTntBuLNWo3O1hgpxbaLMexVEGX68hA40hYTnk4i6bxb3aTsPSbGPMyp2NRVCkqruUGJd9B41/HKld+lWW9YhqHizIKleRcJdjXP1k1QItBzYUX3RBKLtSS3TN+sIs8iu9xBcKbBgTjb414SzcMYx+IxqHQQ7NyACBIN8nP8QRadz1Ns367qHm/HgQA=----ATTACHMENT:----Nzg4MjAwMTc3NjMyNzc2OSAzODUwOTc5ODI5NzcyMzc2IDY3NDQ0Mjk5NjY4Mjk3Mg==