class LoaderChain in Plug 7
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 lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Mapping/ Factory/ LazyLoadingMetadataFactory.php - LoaderChainTest.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Mapping/ Loader/ LoaderChainTest.php - ValidatorBuilder.php in lib/
Symfony/ validator/ Symfony/ Component/ Validator/ ValidatorBuilder.php
File
- lib/
Symfony/ validator/ Symfony/ Component/ 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 |