AnnotationDirectoryLoader

class AnnotationDirectoryLoader extends AnnotationFileLoader

AnnotationDirectoryLoader loads routing information from annotations set on PHP classes and methods.

Methods

LoaderResolverInterface getResolver()

Gets the loader resolver.

from Loader
setResolver(LoaderResolverInterface $resolver)

Sets the loader resolver.

from Loader
mixed import(mixed $resource, string $type = null, Boolean $ignoreErrors = false, string $sourceResource = null)

Imports a resource.

from FileLoader
LoaderInterface resolve(mixed $resource, string $type = null)

Finds a loader able to load an imported resource.

from Loader
__construct(FileLocatorInterface $locator, AnnotationClassLoader $loader, string|array $paths = array())

Constructor.

from AnnotationFileLoader
setCurrentDir($dir) from FileLoader
getLocator() from FileLoader
load(string $path, string $type = null)

Loads from annotations from a directory.

Boolean supports(mixed $resource, string $type = null)

Returns true if this class supports the given resource.

Details

LoaderResolverInterface getResolver()

Gets the loader resolver.

Return Value

LoaderResolverInterface A LoaderResolverInterface instance

setResolver(LoaderResolverInterface $resolver)

Sets the loader resolver.

Parameters

LoaderResolverInterface $resolver A LoaderResolverInterface instance

mixed import(mixed $resource, string $type = null, Boolean $ignoreErrors = false, string $sourceResource = null)

Imports a resource.

Parameters

mixed $resource A Resource
string $type The resource type
Boolean $ignoreErrors Whether to ignore import errors or not
string $sourceResource The original resource importing the new resource

Return Value

mixed

Exceptions

FileLoaderLoadException
FileLoaderImportCircularReferenceException

LoaderInterface resolve(mixed $resource, string $type = null)

Finds a loader able to load an imported resource.

Parameters

mixed $resource A Resource
string $type The resource type

Return Value

LoaderInterface A LoaderInterface instance

Exceptions

FileLoaderLoadException if no loader is found

__construct(FileLocatorInterface $locator, AnnotationClassLoader $loader, string|array $paths = array())

Constructor.

Parameters

FileLocatorInterface $locator A FileLocatorInterface instance
AnnotationClassLoader $loader An AnnotationClassLoader instance
string|array $paths A path or an array of paths where to look for resources

Exceptions

RuntimeException

setCurrentDir($dir)

Parameters

$dir

getLocator()

load(string $path, string $type = null)

Loads from annotations from a directory.

Parameters

string $path A directory path
string $type The resource type

Exceptions

InvalidArgumentException When the directory does not exist or its routes cannot be parsed

Boolean supports(mixed $resource, string $type = null)

Returns true if this class supports the given resource.

Parameters

mixed $resource A resource
string $type The resource type

Return Value

Boolean true if this class supports the given resource, false otherwise

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.html