class Collection in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/validator/Constraints/Collection.php \Symfony\Component\Validator\Constraints\Collection
- 8 vendor/zendframework/zend-feed/src/Reader/Collection.php \Zend\Feed\Reader\Collection
- 8 vendor/zendframework/zend-feed/src/Reader/Collection/Collection.php \Zend\Feed\Reader\Collection\Collection
- 8 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock/Type/Collection.php \phpDocumentor\Reflection\DocBlock\Type\Collection
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Constraints/Collection.php \Symfony\Component\Validator\Constraints\Collection
@Target({"PROPERTY", "METHOD", "ANNOTATION"})
@author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\Validator\Constraint
- class \Symfony\Component\Validator\Constraints\Composite
- class \Symfony\Component\Validator\Constraints\Collection
- class \Symfony\Component\Validator\Constraints\Composite
Expanded class hierarchy of Collection
Related topics
6 files declare their use of Collection
- AnnotationLoaderTest.php in vendor/
symfony/ validator/ Tests/ Mapping/ Loader/ AnnotationLoaderTest.php - CollectionTest.php in vendor/
symfony/ validator/ Tests/ Constraints/ CollectionTest.php - CollectionValidatorTest.php in vendor/
symfony/ validator/ Tests/ Constraints/ CollectionValidatorTest.php - LegacyExecutionContextTest.php in vendor/
symfony/ validator/ Tests/ LegacyExecutionContextTest.php - XmlFileLoaderTest.php in vendor/
symfony/ validator/ Tests/ Mapping/ Loader/ XmlFileLoaderTest.php
2 string references to 'Collection'
- config_collection_install_test.schema.yml in core/
modules/ config/ tests/ config_collection_install_test/ config/ schema/ config_collection_install_test.schema.yml - core/modules/config/tests/config_collection_install_test/config/schema/config_collection_install_test.schema.yml
- EasyRdf_Parser_RdfXml::startState2 in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ RdfXml.php - @ignore
File
- vendor/
symfony/ validator/ Constraints/ Collection.php, line 22
Namespace
Symfony\Component\Validator\ConstraintsView source
class Collection extends Composite {
const MISSING_FIELD_ERROR = 1;
const NO_SUCH_FIELD_ERROR = 2;
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) && count($field) == 1) {
$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';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Collection:: |
public | property | ||
Collection:: |
public | property | ||
Collection:: |
protected static | property |
Maps error codes to the names of their constants. Overrides Constraint:: |
|
Collection:: |
public | property | ||
Collection:: |
public | property | ||
Collection:: |
public | property | ||
Collection:: |
protected | function |
Returns the name of the property that contains the nested constraints. Overrides Composite:: |
|
Collection:: |
public | function |
Returns the name of the required options. Overrides Constraint:: |
|
Collection:: |
protected | function |
Initializes the nested constraints. Overrides Composite:: |
|
Collection:: |
constant | |||
Collection:: |
constant | |||
Collection:: |
public | function |
The groups of the composite and its nested constraints are made
consistent using the following strategy: Overrides Composite:: |
|
Composite:: |
public | function |
Implicit group names are forwarded to nested constraints. Overrides Constraint:: |
|
Constraint:: |
public | property | Domain-specific data attached to a constraint. | |
Constraint:: |
constant | Marks a constraint that can be put onto classes. | ||
Constraint:: |
constant | The name of the group given to all constraints with no explicit group. | ||
Constraint:: |
public | function | Returns the name of the default option. | 18 |
Constraint:: |
public static | function | Returns the name of the given error code. | |
Constraint:: |
public | function | Returns whether the constraint can be put onto classes, properties or both. | 11 |
Constraint:: |
constant | Marks a constraint that can be put onto properties. | ||
Constraint:: |
public | function | Returns the name of the class that validates this constraint. | 11 |
Constraint:: |
public | function | Returns the value of a lazily initialized option. | 1 |
Constraint:: |
public | function | Sets the value of a lazily initialized option. | 1 |
Constraint:: |
public | function | Optimizes the serialized value to minimize storage space. |