class Configuration extends Configuration (View source)

Configuration container for all configuration options of Doctrine.

It combines all configuration options from DBAL & ORM.

Internal note: When adding a new configuration option just write a getter/setter pair.

Methods

void
setProxyDir(string $dir)

Sets the directory where Doctrine generates any necessary proxy class files.

string|null
getProxyDir()

Gets the directory where Doctrine generates any necessary proxy class files.

int
getAutoGenerateProxyClasses()

Gets the strategy for automatically generating proxy classes.

void
setAutoGenerateProxyClasses(boolean|int $autoGenerate)

Sets the strategy for automatically generating proxy classes.

string|null
getProxyNamespace()

Gets the namespace where proxy classes reside.

void
setProxyNamespace(string $ns)

Sets the namespace where proxy classes reside.

void
setMetadataDriverImpl(MappingDriver $driverImpl)

Sets the cache driver implementation that is used for metadata caching.

newDefaultAnnotationDriver(array $paths = array(), bool $useSimpleAnnotationReader = true)

Adds a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader is true, the notation @Entity will work, otherwise, the notation @ORM\Entity will be supported.

void
addEntityNamespace(string $alias, string $namespace)

Adds a namespace under a certain alias.

string
getEntityNamespace(string $entityNamespaceAlias)

Resolves a registered namespace alias to the full namespace.

void
setEntityNamespaces(array $entityNamespaces)

Sets the entity alias map.

array
getEntityNamespaces()

Retrieves the list of registered entity namespace aliases.

MappingDriver|null
getMetadataDriverImpl()

Gets the cache driver implementation that is used for the mapping metadata.

Cache|null
getQueryCacheImpl()

Gets the cache driver implementation that is used for the query cache (SQL cache).

void
setQueryCacheImpl(Cache $cacheImpl)

Sets the cache driver implementation that is used for the query cache (SQL cache).

Cache|null
getHydrationCacheImpl()

Gets the cache driver implementation that is used for the hydration cache (SQL cache).

void
setHydrationCacheImpl(Cache $cacheImpl)

Sets the cache driver implementation that is used for the hydration cache (SQL cache).

Cache|null
getMetadataCacheImpl()

Gets the cache driver implementation that is used for metadata caching.

void
setMetadataCacheImpl(Cache $cacheImpl)

Sets the cache driver implementation that is used for metadata caching.

void
addNamedQuery(string $name, string $dql)

Adds a named DQL query to the configuration.

string
getNamedQuery(string $name)

Gets a previously registered named DQL query.

void
addNamedNativeQuery(string $name, string $sql, ResultSetMapping $rsm)

Adds a named native query to the configuration.

array
getNamedNativeQuery(string $name)

Gets the components of a previously registered named native query.

void
ensureProductionSettings()

Ensures that this Configuration instance contains settings that are suitable for a production environment.

void
addCustomStringFunction(string $name, string|callable $className)

Registers a custom DQL function that produces a string value.

string|null
getCustomStringFunction(string $name)

Gets the implementation class name of a registered custom string DQL function.

void
setCustomStringFunctions(array $functions)

Sets a map of custom DQL string functions.

void
addCustomNumericFunction(string $name, string|callable $className)

Registers a custom DQL function that produces a numeric value.

string|null
getCustomNumericFunction(string $name)

Gets the implementation class name of a registered custom numeric DQL function.

void
setCustomNumericFunctions(array $functions)

Sets a map of custom DQL numeric functions.

void
addCustomDatetimeFunction(string $name, string|callable $className)

Registers a custom DQL function that produces a date/time value.

string|null
getCustomDatetimeFunction(string $name)

Gets the implementation class name of a registered custom date/time DQL function.

void
setCustomDatetimeFunctions(array $functions)

Sets a map of custom DQL date/time functions.

void
setCustomHydrationModes(array $modes)

Sets the custom hydrator modes in one pass.

string|null
getCustomHydrationMode(string $modeName)

Gets the hydrator class for the given hydration mode name.

void
addCustomHydrationMode(string $modeName, string $hydrator)

Adds a custom hydration mode.

void
setClassMetadataFactoryName(string $cmfName)

Sets a class metadata factory.

string
getClassMetadataFactoryName()

No description

addFilter(string $name, string $className)

Adds a filter to the list of possible filters.

string
getFilterClassName(string $name)

Gets the class name for a given filter name.

void
setDefaultRepositoryClassName(string $className)

Sets default repository class.

string
getDefaultRepositoryClassName()

Get default repository class.

void
setNamingStrategy(NamingStrategy $namingStrategy)

Sets naming strategy.

getNamingStrategy()

Gets naming strategy.

void
setQuoteStrategy(QuoteStrategy $quoteStrategy)

Sets quote strategy.

getQuoteStrategy()

Gets quote strategy.

setEntityListenerResolver(EntityListenerResolver $resolver)

Set the entity listener resolver.

getEntityListenerResolver()

Get the entity listener resolver.

setRepositoryFactory(RepositoryFactory $repositoryFactory)

Set the entity repository factory.

getRepositoryFactory()

Get the entity repository factory.

boolean
isSecondLevelCacheEnabled()

No description

void
setSecondLevelCacheEnabled(boolean $flag = true)

No description

void
array
getDefaultQueryHints()

Returns query hints, which will be applied to every query in application

setDefaultQueryHints(array $defaultQueryHints)

Sets array of query hints, which will be applied to every query in application

mixed
getDefaultQueryHint(string $name)

Gets the value of a default query hint. If the hint name is not recognized, FALSE is returned.

setDefaultQueryHint(string $name, mixed $value)

Sets a default query hint. If the hint name is not recognized, it is silently ignored.

Details

void setProxyDir(string $dir)

Sets the directory where Doctrine generates any necessary proxy class files.

Parameters

string $dir

Return Value

void

string|null getProxyDir()

Gets the directory where Doctrine generates any necessary proxy class files.

Return Value

string|null

int getAutoGenerateProxyClasses()

Gets the strategy for automatically generating proxy classes.

Return Value

int Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory.

void setAutoGenerateProxyClasses(boolean|int $autoGenerate)

Sets the strategy for automatically generating proxy classes.

Parameters

boolean|int $autoGenerate Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory. True is converted to AUTOGENERATE_ALWAYS, false to AUTOGENERATE_NEVER.

Return Value

void

string|null getProxyNamespace()

Gets the namespace where proxy classes reside.

Return Value

string|null

void setProxyNamespace(string $ns)

Sets the namespace where proxy classes reside.

Parameters

string $ns

Return Value

void

void setMetadataDriverImpl(MappingDriver $driverImpl)

Sets the cache driver implementation that is used for metadata caching.

Parameters

MappingDriver $driverImpl

Return Value

void

AnnotationDriver newDefaultAnnotationDriver(array $paths = array(), bool $useSimpleAnnotationReader = true)

Adds a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader is true, the notation @Entity will work, otherwise, the notation @ORM\Entity will be supported.

Parameters

array $paths
bool $useSimpleAnnotationReader

Return Value

AnnotationDriver

void addEntityNamespace(string $alias, string $namespace)

Adds a namespace under a certain alias.

Parameters

string $alias
string $namespace

Return Value

void

string getEntityNamespace(string $entityNamespaceAlias)

Resolves a registered namespace alias to the full namespace.

Parameters

string $entityNamespaceAlias

Return Value

string

Exceptions

ORMException

void setEntityNamespaces(array $entityNamespaces)

Sets the entity alias map.

Parameters

array $entityNamespaces

Return Value

void

array getEntityNamespaces()

Retrieves the list of registered entity namespace aliases.

Return Value

array

MappingDriver|null getMetadataDriverImpl()

Gets the cache driver implementation that is used for the mapping metadata.

Return Value

MappingDriver|null

Exceptions

ORMException

Cache|null getQueryCacheImpl()

Gets the cache driver implementation that is used for the query cache (SQL cache).

Return Value

Cache|null

void setQueryCacheImpl(Cache $cacheImpl)

Sets the cache driver implementation that is used for the query cache (SQL cache).

Parameters

Cache $cacheImpl

Return Value

void

Cache|null getHydrationCacheImpl()

Gets the cache driver implementation that is used for the hydration cache (SQL cache).

Return Value

Cache|null

void setHydrationCacheImpl(Cache $cacheImpl)

Sets the cache driver implementation that is used for the hydration cache (SQL cache).

Parameters

Cache $cacheImpl

Return Value

void

Cache|null getMetadataCacheImpl()

Gets the cache driver implementation that is used for metadata caching.

Return Value

Cache|null

void setMetadataCacheImpl(Cache $cacheImpl)

Sets the cache driver implementation that is used for metadata caching.

Parameters

Cache $cacheImpl

Return Value

void

void addNamedQuery(string $name, string $dql)

Adds a named DQL query to the configuration.

Parameters

string $name The name of the query.
string $dql The DQL query string.

Return Value

void

string getNamedQuery(string $name)

Gets a previously registered named DQL query.

Parameters

string $name The name of the query.

Return Value

string The DQL query.

Exceptions

ORMException

void addNamedNativeQuery(string $name, string $sql, ResultSetMapping $rsm)

Adds a named native query to the configuration.

Parameters

string $name The name of the query.
string $sql The native SQL query string.
ResultSetMapping $rsm The ResultSetMapping used for the results of the SQL query.

Return Value

void

array getNamedNativeQuery(string $name)

Gets the components of a previously registered named native query.

Parameters

string $name The name of the query.

Return Value

array A tuple with the first element being the SQL string and the second element being the ResultSetMapping.

Exceptions

ORMException

void ensureProductionSettings()

Ensures that this Configuration instance contains settings that are suitable for a production environment.

Return Value

void

Exceptions

ORMException If a configuration setting has a value that is not suitable for a production environment.

void addCustomStringFunction(string $name, string|callable $className)

Registers a custom DQL function that produces a string value.

Such a function can then be used in any DQL statement in any place where string functions are allowed.

DQL function names are case-insensitive.

Parameters

string $name Function name.
string|callable $className Class name or a callable that returns the function.

Return Value

void

Exceptions

ORMException

string|null getCustomStringFunction(string $name)

Gets the implementation class name of a registered custom string DQL function.

Parameters

string $name

Return Value

string|null

void setCustomStringFunctions(array $functions)

Sets a map of custom DQL string functions.

Keys must be function names and values the FQCN of the implementing class. The function names will be case-insensitive in DQL.

Any previously added string functions are discarded.

Parameters

array $functions The map of custom DQL string functions.

Return Value

void

void addCustomNumericFunction(string $name, string|callable $className)

Registers a custom DQL function that produces a numeric value.

Such a function can then be used in any DQL statement in any place where numeric functions are allowed.

DQL function names are case-insensitive.

Parameters

string $name Function name.
string|callable $className Class name or a callable that returns the function.

Return Value

void

Exceptions

ORMException

string|null getCustomNumericFunction(string $name)

Gets the implementation class name of a registered custom numeric DQL function.

Parameters

string $name

Return Value

string|null

void setCustomNumericFunctions(array $functions)

Sets a map of custom DQL numeric functions.

Keys must be function names and values the FQCN of the implementing class. The function names will be case-insensitive in DQL.

Any previously added numeric functions are discarded.

Parameters

array $functions The map of custom DQL numeric functions.

Return Value

void

void addCustomDatetimeFunction(string $name, string|callable $className)

Registers a custom DQL function that produces a date/time value.

Such a function can then be used in any DQL statement in any place where date/time functions are allowed.

DQL function names are case-insensitive.

Parameters

string $name Function name.
string|callable $className Class name or a callable that returns the function.

Return Value

void

Exceptions

ORMException

string|null getCustomDatetimeFunction(string $name)

Gets the implementation class name of a registered custom date/time DQL function.

Parameters

string $name

Return Value

string|null

void setCustomDatetimeFunctions(array $functions)

Sets a map of custom DQL date/time functions.

Keys must be function names and values the FQCN of the implementing class. The function names will be case-insensitive in DQL.

Any previously added date/time functions are discarded.

Parameters

array $functions The map of custom DQL date/time functions.

Return Value

void

void setCustomHydrationModes(array $modes)

Sets the custom hydrator modes in one pass.

Parameters

array $modes An array of ($modeName => $hydrator).

Return Value

void

string|null getCustomHydrationMode(string $modeName)

Gets the hydrator class for the given hydration mode name.

Parameters

string $modeName The hydration mode name.

Return Value

string|null The hydrator class name.

void addCustomHydrationMode(string $modeName, string $hydrator)

Adds a custom hydration mode.

Parameters

string $modeName The hydration mode name.
string $hydrator The hydrator class name.

Return Value

void

void setClassMetadataFactoryName(string $cmfName)

Sets a class metadata factory.

Parameters

string $cmfName

Return Value

void

string getClassMetadataFactoryName()

Return Value

string

addFilter(string $name, string $className)

Adds a filter to the list of possible filters.

Parameters

string $name The name of the filter.
string $className The class name of the filter.

string getFilterClassName(string $name)

Gets the class name for a given filter name.

Parameters

string $name The name of the filter.

Return Value

string The class name of the filter, or null of it is not defined.

void setDefaultRepositoryClassName(string $className)

Sets default repository class.

Parameters

string $className

Return Value

void

Exceptions

ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository

string getDefaultRepositoryClassName()

Get default repository class.

Return Value

string

void setNamingStrategy(NamingStrategy $namingStrategy)

Sets naming strategy.

Parameters

NamingStrategy $namingStrategy

Return Value

void

NamingStrategy getNamingStrategy()

Gets naming strategy.

.

Return Value

NamingStrategy

void setQuoteStrategy(QuoteStrategy $quoteStrategy)

Sets quote strategy.

Parameters

QuoteStrategy $quoteStrategy

Return Value

void

QuoteStrategy getQuoteStrategy()

Gets quote strategy.

Return Value

QuoteStrategy

setEntityListenerResolver(EntityListenerResolver $resolver)

Set the entity listener resolver.

Parameters

EntityListenerResolver $resolver

EntityListenerResolver getEntityListenerResolver()

Get the entity listener resolver.

Return Value

EntityListenerResolver

setRepositoryFactory(RepositoryFactory $repositoryFactory)

Set the entity repository factory.

Parameters

RepositoryFactory $repositoryFactory

RepositoryFactory getRepositoryFactory()

Get the entity repository factory.

Return Value

RepositoryFactory

boolean isSecondLevelCacheEnabled()

Return Value

boolean

void setSecondLevelCacheEnabled(boolean $flag = true)

Parameters

boolean $flag

Return Value

void

void setSecondLevelCacheConfiguration(CacheConfiguration $cacheConfig)

Parameters

CacheConfiguration $cacheConfig

Return Value

void

CacheConfiguration|null getSecondLevelCacheConfiguration()

Return Value

CacheConfiguration|null

array getDefaultQueryHints()

Returns query hints, which will be applied to every query in application

Return Value

array

setDefaultQueryHints(array $defaultQueryHints)

Sets array of query hints, which will be applied to every query in application

Parameters

array $defaultQueryHints

mixed getDefaultQueryHint(string $name)

Gets the value of a default query hint. If the hint name is not recognized, FALSE is returned.

Parameters

string $name The name of the hint.

Return Value

mixed The value of the hint or FALSE, if the hint name is not recognized.

setDefaultQueryHint(string $name, mixed $value)

Sets a default query hint. If the hint name is not recognized, it is silently ignored.

Parameters

string $name The name of the hint.
mixed $value The value of the hint.