class Configuration extends Configuration (View source)

Configuration class for the DocumentManager. When setting up your DocumentManager you can optionally specify an instance of this class as the second argument.

If you do not pass a configuration object, a blank one will be created for you.

<?php

$config = new Configuration();
$dm = DocumentManager::create(new Connection(), $config);

Constants

AUTOGENERATE_NEVER

Never autogenerate a proxy/hydrator and rely that it was generated by some process before deployment. Copied from \Doctrine\Common\Proxy\AbstractProxyFactory.

AUTOGENERATE_ALWAYS

Always generates a new proxy/hydrator in every request.

This is only sane during development. Copied from \Doctrine\Common\Proxy\AbstractProxyFactory.

AUTOGENERATE_FILE_NOT_EXISTS

Autogenerate the proxy/hydrator class when the file does not exist.

This strategy causes a file exists call whenever any proxy/hydrator is used the first time in a request. Copied from \Doctrine\Common\Proxy\AbstractProxyFactory.

AUTOGENERATE_EVAL

Generate the proxy/hydrator classes using eval().

This strategy is only sane for development. Copied from \Doctrine\Common\Proxy\AbstractProxyFactory.

Methods

addDocumentNamespace(string $alias, string $namespace)

Adds a namespace under a certain alias.

string
getDocumentNamespace(string $documentNamespaceAlias)

Resolves a registered namespace alias to the full namespace.

array
getDocumentNamespaces()

Retrieves the list of registered document namespace aliases.

void
setDocumentNamespaces(array $documentNamespaces)

Set the document alias map

setMetadataDriverImpl(MappingDriver $driverImpl)

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

newDefaultAnnotationDriver(array $paths = array())

Add a new default annotation driver with a correctly configured annotation reader.

MappingDriver
getMetadataDriverImpl()

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

Cache
getMetadataCacheImpl()

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

setMetadataCacheImpl(Cache $cacheImpl)

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

setProxyDir(string $dir)

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

string
getProxyDir()

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

boolean|integer
getAutoGenerateProxyClasses()

Gets a boolean flag that indicates whether proxy classes should always be regenerated during each script execution.

setAutoGenerateProxyClasses(boolean|int $bool)

Sets a boolean flag that indicates whether proxy classes should always be regenerated during each script execution.

string
getProxyNamespace()

Gets the namespace where proxy classes reside.

setProxyNamespace(string $ns)

Sets the namespace where proxy classes reside.

setHydratorDir(string $dir)

Sets the directory where Doctrine generates hydrator class files.

string
getHydratorDir()

Gets the directory where Doctrine generates hydrator class files.

boolean|integer
getAutoGenerateHydratorClasses()

Gets a boolean flag that indicates whether hydrator classes should always be regenerated during each script execution.

setAutoGenerateHydratorClasses(boolean|integer $bool)

Sets a boolean flag that indicates whether hydrator classes should always be regenerated during each script execution.

string
getHydratorNamespace()

Gets the namespace where hydrator classes reside.

setHydratorNamespace(string $ns)

Sets the namespace where hydrator classes reside.

setDefaultDB(string $defaultDB)

Sets the default DB to use for all Documents that do not specify a database.

string
getDefaultDB()

Gets the default DB to use for all Documents that do not specify a database.

setClassMetadataFactoryName(string $cmfName)

Set the class metadata factory class name.

string
getClassMetadataFactoryName()

Gets the class metadata factory class name.

array
getDefaultCommitOptions()

Gets array of default commit options.

setDefaultCommitOptions(boolean $defaultCommitOptions)

Sets array of default commit options.

addFilter(string $name, string $className, array $parameters = array())

Add a filter to the list of possible filters.

string|null
getFilterClassName(string $name)

Gets the class name for a given filter name.

array|null
getFilterParameters(string $name)

Gets the parameters for a given filter name.

void
setDefaultRepositoryClassName(string $className)

Sets default repository class.

string
getDefaultRepositoryClassName()

Get default repository class.

setRepositoryFactory(RepositoryFactory $repositoryFactory)

Set the document repository factory.

getRepositoryFactory()

Get the document repository factory.

Details

addDocumentNamespace(string $alias, string $namespace)

Adds a namespace under a certain alias.

Parameters

string $alias
string $namespace

string getDocumentNamespace(string $documentNamespaceAlias)

Resolves a registered namespace alias to the full namespace.

Parameters

string $documentNamespaceAlias

Return Value

string

Exceptions

MongoDBException

array getDocumentNamespaces()

Retrieves the list of registered document namespace aliases.

Return Value

array

void setDocumentNamespaces(array $documentNamespaces)

Set the document alias map

Parameters

array $documentNamespaces

Return Value

void

setMetadataDriverImpl(MappingDriver $driverImpl)

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

Parameters

MappingDriver $driverImpl

AnnotationDriver newDefaultAnnotationDriver(array $paths = array())

Add a new default annotation driver with a correctly configured annotation reader.

Parameters

array $paths

Return Value

AnnotationDriver

MappingDriver getMetadataDriverImpl()

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

Return Value

MappingDriver

Cache getMetadataCacheImpl()

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

Return Value

Cache

setMetadataCacheImpl(Cache $cacheImpl)

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

Parameters

Cache $cacheImpl

setProxyDir(string $dir)

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

Parameters

string $dir

string getProxyDir()

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

Return Value

string

boolean|integer getAutoGenerateProxyClasses()

Gets a boolean flag that indicates whether proxy classes should always be regenerated during each script execution.

Return Value

boolean|integer

setAutoGenerateProxyClasses(boolean|int $bool)

Sets a boolean flag that indicates whether proxy classes should always be regenerated during each script execution.

Parameters

boolean|int $bool Possible values are constants of Doctrine\Common\Proxy\AbstractProxyFactory

string getProxyNamespace()

Gets the namespace where proxy classes reside.

Return Value

string

setProxyNamespace(string $ns)

Sets the namespace where proxy classes reside.

Parameters

string $ns

setHydratorDir(string $dir)

Sets the directory where Doctrine generates hydrator class files.

Parameters

string $dir

string getHydratorDir()

Gets the directory where Doctrine generates hydrator class files.

Return Value

string

boolean|integer getAutoGenerateHydratorClasses()

Gets a boolean flag that indicates whether hydrator classes should always be regenerated during each script execution.

Return Value

boolean|integer Possible values are defined constants

setAutoGenerateHydratorClasses(boolean|integer $bool)

Sets a boolean flag that indicates whether hydrator classes should always be regenerated during each script execution.

Parameters

boolean|integer $bool

string getHydratorNamespace()

Gets the namespace where hydrator classes reside.

Return Value

string

setHydratorNamespace(string $ns)

Sets the namespace where hydrator classes reside.

Parameters

string $ns

setDefaultDB(string $defaultDB)

Sets the default DB to use for all Documents that do not specify a database.

Parameters

string $defaultDB

string getDefaultDB()

Gets the default DB to use for all Documents that do not specify a database.

Return Value

string $defaultDB

setClassMetadataFactoryName(string $cmfName)

Set the class metadata factory class name.

Parameters

string $cmfName

string getClassMetadataFactoryName()

Gets the class metadata factory class name.

Return Value

string

array getDefaultCommitOptions()

Gets array of default commit options.

Return Value

array

setDefaultCommitOptions(boolean $defaultCommitOptions)

Sets array of default commit options.

Parameters

boolean $defaultCommitOptions

addFilter(string $name, string $className, array $parameters = array())

Add a filter to the list of possible filters.

Parameters

string $name The name of the filter.
string $className The class name of the filter.
array $parameters The parameters for the filter.

string|null getFilterClassName(string $name)

Gets the class name for a given filter name.

Parameters

string $name The name of the filter.

Return Value

string|null The filter class name, or null if it is undefined

array|null getFilterParameters(string $name)

Gets the parameters for a given filter name.

Parameters

string $name The name of the filter.

Return Value

array|null The filter parameters, or null if it is undefined

void setDefaultRepositoryClassName(string $className)

Sets default repository class.

Parameters

string $className

Return Value

void

Exceptions

MongoDBException If not is a ObjectRepository

string getDefaultRepositoryClassName()

Get default repository class.

Return Value

string

setRepositoryFactory(RepositoryFactory $repositoryFactory)

Set the document repository factory.

Parameters

RepositoryFactory $repositoryFactory

RepositoryFactory getRepositoryFactory()

Get the document repository factory.

Return Value

RepositoryFactory