class LoaderChain in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/validator/Mapping/Loader/LoaderChain.php \Symfony\Component\Validator\Mapping\Loader\LoaderChain
- 8 vendor/symfony/serializer/Mapping/Loader/LoaderChain.php \Symfony\Component\Serializer\Mapping\Loader\LoaderChain
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Mapping/Loader/LoaderChain.php \Symfony\Component\Validator\Mapping\Loader\LoaderChain
Loads validation metadata from multiple {@link LoaderInterface} instances.
Pass the loaders when constructing the chain. Once {@link loadClassMetadata()} is called, that method will be called on all loaders in the chain.
@author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\Validator\Mapping\Loader\LoaderChain implements LoaderInterface
Expanded class hierarchy of LoaderChain
3 files declare their use of LoaderChain
- LazyLoadingMetadataFactory.php in vendor/
symfony/ validator/ Mapping/ Factory/ LazyLoadingMetadataFactory.php - LoaderChainTest.php in vendor/
symfony/ validator/ Tests/ Mapping/ Loader/ LoaderChainTest.php - ValidatorBuilder.php in vendor/
symfony/ validator/ ValidatorBuilder.php
File
- vendor/
symfony/ validator/ Mapping/ Loader/ LoaderChain.php, line 26
Namespace
Symfony\Component\Validator\Mapping\LoaderView source
class LoaderChain implements LoaderInterface {
/**
* @var LoaderInterface[]
*/
protected $loaders;
/**
* @param LoaderInterface[] $loaders The metadata loaders to use
*
* @throws MappingException If any of the loaders has an invalid type
*/
public function __construct(array $loaders) {
foreach ($loaders as $loader) {
if (!$loader instanceof LoaderInterface) {
throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', get_class($loader)));
}
}
$this->loaders = $loaders;
}
/**
* {@inheritdoc}
*/
public function loadClassMetadata(ClassMetadata $metadata) {
$success = false;
foreach ($this->loaders as $loader) {
$success = $loader
->loadClassMetadata($metadata) || $success;
}
return $success;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LoaderChain:: |
protected | property | ||
LoaderChain:: |
public | function |
Loads validation metadata into a {@link ClassMetadata} instance. Overrides LoaderInterface:: |
|
LoaderChain:: |
public | function | 1 |