class LazyLoadingMetadataFactory implements MetadataFactoryInterface
Creates new {@link ClassMetadataInterface} instances.
Whenever {@link getMetadataFor()} is called for the first time with a given class name or object of that class, a new metadata instance is created and returned. On subsequent requests for the same class, the same metadata instance will be returned.
You can optionally pass a {@link LoaderInterface} instance to the constructor. Whenever a new metadata instance is created, it is passed to the loader, which can configure the metadata based on configuration loaded from the filesystem or a database. If you want to use multiple loaders, wrap them in a {@link LoaderChain}.
You can also optionally pass a {@link CacheInterface} instance to the constructor. This cache will be used for persisting the generated metadata between multiple PHP requests.
protected | $loader | ||
protected | $cache | ||
protected ClassMetadata[] | $loadedClasses | The loaded metadata, indexed by class name. |
__construct(LoaderInterface $loader = null, CacheInterface $cache = null) Creates a new metadata factory. | ||
MetadataInterface | getMetadataFor(mixed $value) Returns the metadata for the given value. | |
bool | hasMetadataFor(mixed $value) Returns whether the class is able to return metadata for the given value. |
Creates a new metadata factory.
LoaderInterface | $loader | The loader for configuring new metadata |
CacheInterface | $cache | The cache for persisting metadata between multiple PHP requests |
Returns the metadata for the given value.
mixed | $value | Some value |
MetadataInterface | The metadata for the value |
NoSuchMetadataException | If no metadata exists for the given value |
Returns whether the class is able to return metadata for the given value.
mixed | $value | Some value |
bool | Whether metadata can be returned for that value |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.html