1
0
mirror of synced 2025-02-02 05:21:44 +03:00

Merge pull request #528 from BenMorel/master

Documentation fixes
This commit is contained in:
Benjamin Eberlei 2012-12-23 12:22:09 -08:00
commit e319e34783
284 changed files with 6321 additions and 2425 deletions

View File

@ -42,18 +42,22 @@ use Doctrine\ORM\ORMInvalidArgumentException;
abstract class AbstractQuery abstract class AbstractQuery
{ {
/* Hydration mode constants */ /* Hydration mode constants */
/** /**
* Hydrates an object graph. This is the default behavior. * Hydrates an object graph. This is the default behavior.
*/ */
const HYDRATE_OBJECT = 1; const HYDRATE_OBJECT = 1;
/** /**
* Hydrates an array graph. * Hydrates an array graph.
*/ */
const HYDRATE_ARRAY = 2; const HYDRATE_ARRAY = 2;
/** /**
* Hydrates a flat, rectangular result set with scalar values. * Hydrates a flat, rectangular result set with scalar values.
*/ */
const HYDRATE_SCALAR = 3; const HYDRATE_SCALAR = 3;
/** /**
* Hydrates a single scalar value. * Hydrates a single scalar value.
*/ */
@ -65,27 +69,37 @@ abstract class AbstractQuery
const HYDRATE_SIMPLEOBJECT = 5; const HYDRATE_SIMPLEOBJECT = 5;
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection The parameter map of this query. * The parameter map of this query.
*
* @var \Doctrine\Common\Collections\ArrayCollection
*/ */
protected $parameters; protected $parameters;
/** /**
* @var \Doctrine\ORM\Query\ResultSetMapping The user-specified ResultSetMapping to use. * The user-specified ResultSetMapping to use.
*
* @var \Doctrine\ORM\Query\ResultSetMapping
*/ */
protected $_resultSetMapping; protected $_resultSetMapping;
/** /**
* @var \Doctrine\ORM\EntityManager The entity manager used by this query object. * The entity manager used by this query object.
*
* @var \Doctrine\ORM\EntityManager
*/ */
protected $_em; protected $_em;
/** /**
* @var array The map of query hints. * The map of query hints.
*
* @var array
*/ */
protected $_hints = array(); protected $_hints = array();
/** /**
* @var integer The hydration mode. * The hydration mode.
*
* @var integer
*/ */
protected $_hydrationMode = self::HYDRATE_OBJECT; protected $_hydrationMode = self::HYDRATE_OBJECT;
@ -95,7 +109,9 @@ abstract class AbstractQuery
protected $_queryCacheProfile; protected $_queryCacheProfile;
/** /**
* @var boolean Boolean value that indicates whether or not expire the result cache. * Whether or not expire the result cache.
*
* @var boolean
*/ */
protected $_expireResultCache = false; protected $_expireResultCache = false;
@ -107,7 +123,7 @@ abstract class AbstractQuery
/** /**
* Initializes a new instance of a class derived from <tt>AbstractQuery</tt>. * Initializes a new instance of a class derived from <tt>AbstractQuery</tt>.
* *
* @param \Doctrine\ORM\EntityManager $entityManager * @param \Doctrine\ORM\EntityManager $em
*/ */
public function __construct(EntityManager $em) public function __construct(EntityManager $em)
{ {
@ -208,11 +224,11 @@ abstract class AbstractQuery
/** /**
* Sets a query parameter. * Sets a query parameter.
* *
* @param string|integer $key The parameter position or name. * @param string|int $key The parameter position or name.
* @param mixed $value The parameter value. * @param mixed $value The parameter value.
* @param string $type The parameter type. If specified, the given value will be run through * @param string|null $type The parameter type. If specified, the given value will be run through
* the type conversion of this type. This is usually not needed for * the type conversion of this type. This is usually not needed for
* strings and numeric types. * strings and numeric types.
* *
* @return \Doctrine\ORM\AbstractQuery This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
@ -241,10 +257,13 @@ abstract class AbstractQuery
} }
/** /**
* Process an individual parameter value * Processes an individual parameter value.
* *
* @param mixed $value * @param mixed $value
*
* @return array * @return array
*
* @throws ORMInvalidArgumentException
*/ */
public function processParameterValue($value) public function processParameterValue($value)
{ {
@ -272,6 +291,7 @@ abstract class AbstractQuery
* Sets the ResultSetMapping that should be used for hydration. * Sets the ResultSetMapping that should be used for hydration.
* *
* @param \Doctrine\ORM\Query\ResultSetMapping $rsm * @param \Doctrine\ORM\Query\ResultSetMapping $rsm
*
* @return \Doctrine\ORM\AbstractQuery * @return \Doctrine\ORM\AbstractQuery
*/ */
public function setResultSetMapping(Query\ResultSetMapping $rsm) public function setResultSetMapping(Query\ResultSetMapping $rsm)
@ -300,6 +320,7 @@ abstract class AbstractQuery
* $query->setHydrationCacheProfile(new QueryCacheProfile($lifetime, $resultKey)); * $query->setHydrationCacheProfile(new QueryCacheProfile($lifetime, $resultKey));
* *
* @param \Doctrine\DBAL\Cache\QueryCacheProfile $profile * @param \Doctrine\DBAL\Cache\QueryCacheProfile $profile
*
* @return \Doctrine\ORM\AbstractQuery * @return \Doctrine\ORM\AbstractQuery
*/ */
public function setHydrationCacheProfile(QueryCacheProfile $profile = null) public function setHydrationCacheProfile(QueryCacheProfile $profile = null)
@ -329,6 +350,7 @@ abstract class AbstractQuery
* result cache driver is used from the configuration. * result cache driver is used from the configuration.
* *
* @param \Doctrine\DBAL\Cache\QueryCacheProfile $profile * @param \Doctrine\DBAL\Cache\QueryCacheProfile $profile
*
* @return \Doctrine\ORM\AbstractQuery * @return \Doctrine\ORM\AbstractQuery
*/ */
public function setResultCacheProfile(QueryCacheProfile $profile = null) public function setResultCacheProfile(QueryCacheProfile $profile = null)
@ -346,8 +368,11 @@ abstract class AbstractQuery
/** /**
* Defines a cache driver to be used for caching result sets and implictly enables caching. * Defines a cache driver to be used for caching result sets and implictly enables caching.
* *
* @param \Doctrine\Common\Cache\Cache $driver Cache driver * @param \Doctrine\Common\Cache\Cache|null $resultCacheDriver Cache driver
*
* @return \Doctrine\ORM\AbstractQuery * @return \Doctrine\ORM\AbstractQuery
*
* @throws ORMException
*/ */
public function setResultCacheDriver($resultCacheDriver = null) public function setResultCacheDriver($resultCacheDriver = null)
{ {
@ -366,6 +391,7 @@ abstract class AbstractQuery
* Returns the cache driver used for caching result sets. * Returns the cache driver used for caching result sets.
* *
* @deprecated * @deprecated
*
* @return \Doctrine\Common\Cache\Cache Cache driver * @return \Doctrine\Common\Cache\Cache Cache driver
*/ */
public function getResultCacheDriver() public function getResultCacheDriver()
@ -383,7 +409,8 @@ abstract class AbstractQuery
* *
* @param boolean $bool * @param boolean $bool
* @param integer $lifetime * @param integer $lifetime
* @param string $resultCacheId * @param string $resultCacheId
*
* @return \Doctrine\ORM\AbstractQuery This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
public function useResultCache($bool, $lifetime = null, $resultCacheId = null) public function useResultCache($bool, $lifetime = null, $resultCacheId = null)
@ -404,6 +431,7 @@ abstract class AbstractQuery
* Defines how long the result cache will be active before expire. * Defines how long the result cache will be active before expire.
* *
* @param integer $lifetime How long the cache entry is valid. * @param integer $lifetime How long the cache entry is valid.
*
* @return \Doctrine\ORM\AbstractQuery This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
public function setResultCacheLifetime($lifetime) public function setResultCacheLifetime($lifetime)
@ -421,6 +449,7 @@ abstract class AbstractQuery
* Retrieves the lifetime of resultset cache. * Retrieves the lifetime of resultset cache.
* *
* @deprecated * @deprecated
*
* @return integer * @return integer
*/ */
public function getResultCacheLifetime() public function getResultCacheLifetime()
@ -432,6 +461,7 @@ abstract class AbstractQuery
* Defines if the result cache is active or not. * Defines if the result cache is active or not.
* *
* @param boolean $expire Whether or not to force resultset cache expiration. * @param boolean $expire Whether or not to force resultset cache expiration.
*
* @return \Doctrine\ORM\AbstractQuery This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
public function expireResultCache($expire = true) public function expireResultCache($expire = true)
@ -464,9 +494,10 @@ abstract class AbstractQuery
* *
* $fetchMode can be one of ClassMetadata::FETCH_EAGER or ClassMetadata::FETCH_LAZY * $fetchMode can be one of ClassMetadata::FETCH_EAGER or ClassMetadata::FETCH_LAZY
* *
* @param string $class * @param string $class
* @param string $assocName * @param string $assocName
* @param int $fetchMode * @param int $fetchMode
*
* @return AbstractQuery * @return AbstractQuery
*/ */
public function setFetchMode($class, $assocName, $fetchMode) public function setFetchMode($class, $assocName, $fetchMode)
@ -485,6 +516,7 @@ abstract class AbstractQuery
* *
* @param integer $hydrationMode Doctrine processing mode to be used during hydration process. * @param integer $hydrationMode Doctrine processing mode to be used during hydration process.
* One of the Query::HYDRATE_* constants. * One of the Query::HYDRATE_* constants.
*
* @return \Doctrine\ORM\AbstractQuery This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
public function setHydrationMode($hydrationMode) public function setHydrationMode($hydrationMode)
@ -509,6 +541,8 @@ abstract class AbstractQuery
* *
* Alias for execute(null, $hydrationMode = HYDRATE_OBJECT). * Alias for execute(null, $hydrationMode = HYDRATE_OBJECT).
* *
* @param int $hydrationMode
*
* @return array * @return array
*/ */
public function getResult($hydrationMode = self::HYDRATE_OBJECT) public function getResult($hydrationMode = self::HYDRATE_OBJECT)
@ -543,9 +577,11 @@ abstract class AbstractQuery
/** /**
* Get exactly one result or null. * Get exactly one result or null.
* *
* @throws NonUniqueResultException
* @param int $hydrationMode * @param int $hydrationMode
*
* @return mixed * @return mixed
*
* @throws NonUniqueResultException
*/ */
public function getOneOrNullResult($hydrationMode = null) public function getOneOrNullResult($hydrationMode = null)
{ {
@ -575,9 +611,11 @@ abstract class AbstractQuery
* If there is no result, a NoResultException is thrown. * If there is no result, a NoResultException is thrown.
* *
* @param integer $hydrationMode * @param integer $hydrationMode
*
* @return mixed * @return mixed
*
* @throws NonUniqueResultException If the query result is not unique. * @throws NonUniqueResultException If the query result is not unique.
* @throws NoResultException If the query returned no result. * @throws NoResultException If the query returned no result.
*/ */
public function getSingleResult($hydrationMode = null) public function getSingleResult($hydrationMode = null)
{ {
@ -604,6 +642,7 @@ abstract class AbstractQuery
* Alias for getSingleResult(HYDRATE_SINGLE_SCALAR). * Alias for getSingleResult(HYDRATE_SINGLE_SCALAR).
* *
* @return mixed * @return mixed
*
* @throws QueryException If the query result is not unique. * @throws QueryException If the query result is not unique.
*/ */
public function getSingleScalarResult() public function getSingleScalarResult()
@ -614,8 +653,9 @@ abstract class AbstractQuery
/** /**
* Sets a query hint. If the hint name is not recognized, it is silently ignored. * Sets a query hint. If the hint name is not recognized, it is silently ignored.
* *
* @param string $name The name of the hint. * @param string $name The name of the hint.
* @param mixed $value The value of the hint. * @param mixed $value The value of the hint.
*
* @return \Doctrine\ORM\AbstractQuery * @return \Doctrine\ORM\AbstractQuery
*/ */
public function setHint($name, $value) public function setHint($name, $value)
@ -629,6 +669,7 @@ abstract class AbstractQuery
* Gets the value of a query hint. If the hint name is not recognized, FALSE is returned. * Gets the value of a query hint. If the hint name is not recognized, FALSE is returned.
* *
* @param string $name The name of the hint. * @param string $name The name of the hint.
*
* @return mixed The value of the hint or FALSE, if the hint name is not recognized. * @return mixed The value of the hint or FALSE, if the hint name is not recognized.
*/ */
public function getHint($name) public function getHint($name)
@ -650,8 +691,9 @@ abstract class AbstractQuery
* Executes the query and returns an IterableResult that can be used to incrementally * Executes the query and returns an IterableResult that can be used to incrementally
* iterate over the result. * iterate over the result.
* *
* @param \Doctrine\Common\Collections\ArrayCollection|array $parameters The query parameters. * @param ArrayCollection|array|null $parameters The query parameters.
* @param integer $hydrationMode The hydration mode to use. * @param integer|null $hydrationMode The hydration mode to use.
*
* @return \Doctrine\ORM\Internal\Hydration\IterableResult * @return \Doctrine\ORM\Internal\Hydration\IterableResult
*/ */
public function iterate($parameters = null, $hydrationMode = null) public function iterate($parameters = null, $hydrationMode = null)
@ -674,8 +716,9 @@ abstract class AbstractQuery
/** /**
* Executes the query. * Executes the query.
* *
* @param \Doctrine\Common\Collections\ArrayCollection|array $parameters Query parameters. * @param ArrayCollection|array|null $parameters Query parameters.
* @param integer $hydrationMode Processing mode to be used during the hydration process. * @param integer|null $hydrationMode Processing mode to be used during the hydration process.
*
* @return mixed * @return mixed
*/ */
public function execute($parameters = null, $hydrationMode = null) public function execute($parameters = null, $hydrationMode = null)
@ -760,6 +803,7 @@ abstract class AbstractQuery
* generated for you. * generated for you.
* *
* @param string $id * @param string $id
*
* @return \Doctrine\ORM\AbstractQuery This query instance. * @return \Doctrine\ORM\AbstractQuery This query instance.
*/ */
public function setResultCacheId($id) public function setResultCacheId($id)
@ -775,6 +819,7 @@ abstract class AbstractQuery
* Get the result cache id to use to store the result set cache entry if set. * Get the result cache id to use to store the result set cache entry if set.
* *
* @deprecated * @deprecated
*
* @return string * @return string
*/ */
public function getResultCacheId() public function getResultCacheId()

View File

@ -49,6 +49,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the directory where Doctrine generates any necessary proxy class files. * Sets the directory where Doctrine generates any necessary proxy class files.
* *
* @param string $dir * @param string $dir
*
* @return void
*/ */
public function setProxyDir($dir) public function setProxyDir($dir)
{ {
@ -58,7 +60,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Gets the directory where Doctrine generates any necessary proxy class files. * Gets the directory where Doctrine generates any necessary proxy class files.
* *
* @return string * @return string|null
*/ */
public function getProxyDir() public function getProxyDir()
{ {
@ -85,6 +87,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* during each script execution. * during each script execution.
* *
* @param boolean $bool * @param boolean $bool
*
* @return void
*/ */
public function setAutoGenerateProxyClasses($bool) public function setAutoGenerateProxyClasses($bool)
{ {
@ -94,7 +98,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Gets the namespace where proxy classes reside. * Gets the namespace where proxy classes reside.
* *
* @return string * @return string|null
*/ */
public function getProxyNamespace() public function getProxyNamespace()
{ {
@ -107,6 +111,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the namespace where proxy classes reside. * Sets the namespace where proxy classes reside.
* *
* @param string $ns * @param string $ns
*
* @return void
*/ */
public function setProxyNamespace($ns) public function setProxyNamespace($ns)
{ {
@ -117,6 +123,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the cache driver implementation that is used for metadata caching. * Sets the cache driver implementation that is used for metadata caching.
* *
* @param MappingDriver $driverImpl * @param MappingDriver $driverImpl
*
* @return void
*
* @todo Force parameter to be a Closure to ensure lazy evaluation * @todo Force parameter to be a Closure to ensure lazy evaluation
* (as soon as a metadata cache is in effect, the driver never needs to initialize). * (as soon as a metadata cache is in effect, the driver never needs to initialize).
*/ */
@ -126,11 +135,12 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Add a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader * 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. * is true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported.
* *
* @param array $paths * @param array $paths
* @param bool $useSimpleAnnotationReader * @param bool $useSimpleAnnotationReader
*
* @return AnnotationDriver * @return AnnotationDriver
*/ */
public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = true) public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = true)
@ -157,6 +167,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* *
* @param string $alias * @param string $alias
* @param string $namespace * @param string $namespace
*
* @return void
*/ */
public function addEntityNamespace($alias, $namespace) public function addEntityNamespace($alias, $namespace)
{ {
@ -167,8 +179,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Resolves a registered namespace alias to the full namespace. * Resolves a registered namespace alias to the full namespace.
* *
* @param string $entityNamespaceAlias * @param string $entityNamespaceAlias
* @throws ORMException *
* @return string * @return string
*
* @throws ORMException
*/ */
public function getEntityNamespace($entityNamespaceAlias) public function getEntityNamespace($entityNamespaceAlias)
{ {
@ -180,9 +194,11 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set the entity alias map * Sets the entity alias map.
* *
* @param array $entityNamespaces * @param array $entityNamespaces
*
* @return void
*/ */
public function setEntityNamespaces(array $entityNamespaces) public function setEntityNamespaces(array $entityNamespaces)
{ {
@ -202,8 +218,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Gets the cache driver implementation that is used for the mapping metadata. * Gets the cache driver implementation that is used for the mapping metadata.
* *
* @return MappingDriver|null
*
* @throws ORMException * @throws ORMException
* @return MappingDriver
*/ */
public function getMetadataDriverImpl() public function getMetadataDriverImpl()
{ {
@ -215,7 +232,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Gets the cache driver implementation that is used for the query cache (SQL cache). * Gets the cache driver implementation that is used for the query cache (SQL cache).
* *
* @return \Doctrine\Common\Cache\Cache * @return \Doctrine\Common\Cache\Cache|null
*/ */
public function getQueryCacheImpl() public function getQueryCacheImpl()
{ {
@ -228,6 +245,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the cache driver implementation that is used for the query cache (SQL cache). * Sets the cache driver implementation that is used for the query cache (SQL cache).
* *
* @param \Doctrine\Common\Cache\Cache $cacheImpl * @param \Doctrine\Common\Cache\Cache $cacheImpl
*
* @return void
*/ */
public function setQueryCacheImpl(Cache $cacheImpl) public function setQueryCacheImpl(Cache $cacheImpl)
{ {
@ -237,7 +256,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Gets the cache driver implementation that is used for the hydration cache (SQL cache). * Gets the cache driver implementation that is used for the hydration cache (SQL cache).
* *
* @return \Doctrine\Common\Cache\Cache * @return \Doctrine\Common\Cache\Cache|null
*/ */
public function getHydrationCacheImpl() public function getHydrationCacheImpl()
{ {
@ -250,6 +269,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the cache driver implementation that is used for the hydration cache (SQL cache). * Sets the cache driver implementation that is used for the hydration cache (SQL cache).
* *
* @param \Doctrine\Common\Cache\Cache $cacheImpl * @param \Doctrine\Common\Cache\Cache $cacheImpl
*
* @return void
*/ */
public function setHydrationCacheImpl(Cache $cacheImpl) public function setHydrationCacheImpl(Cache $cacheImpl)
{ {
@ -259,7 +280,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Gets the cache driver implementation that is used for metadata caching. * Gets the cache driver implementation that is used for metadata caching.
* *
* @return \Doctrine\Common\Cache\Cache * @return \Doctrine\Common\Cache\Cache|null
*/ */
public function getMetadataCacheImpl() public function getMetadataCacheImpl()
{ {
@ -272,6 +293,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the cache driver implementation that is used for metadata caching. * Sets the cache driver implementation that is used for metadata caching.
* *
* @param \Doctrine\Common\Cache\Cache $cacheImpl * @param \Doctrine\Common\Cache\Cache $cacheImpl
*
* @return void
*/ */
public function setMetadataCacheImpl(Cache $cacheImpl) public function setMetadataCacheImpl(Cache $cacheImpl)
{ {
@ -282,7 +305,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Adds a named DQL query to the configuration. * Adds a named DQL query to the configuration.
* *
* @param string $name The name of the query. * @param string $name The name of the query.
* @param string $dql The DQL query string. * @param string $dql The DQL query string.
*
* @return void
*/ */
public function addNamedQuery($name, $dql) public function addNamedQuery($name, $dql)
{ {
@ -293,8 +318,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Gets a previously registered named DQL query. * Gets a previously registered named DQL query.
* *
* @param string $name The name of the query. * @param string $name The name of the query.
* @throws ORMException *
* @return string The DQL query. * @return string The DQL query.
*
* @throws ORMException
*/ */
public function getNamedQuery($name) public function getNamedQuery($name)
{ {
@ -311,6 +338,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* @param string $name The name of the query. * @param string $name The name of the query.
* @param string $sql The native SQL query string. * @param string $sql The native SQL query string.
* @param Query\ResultSetMapping $rsm The ResultSetMapping used for the results of the SQL query. * @param Query\ResultSetMapping $rsm The ResultSetMapping used for the results of the SQL query.
*
* @return void
*/ */
public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm) public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm)
{ {
@ -320,10 +349,12 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Gets the components of a previously registered named native query. * Gets the components of a previously registered named native query.
* *
* @param string $name The name of the query. * @param string $name The name of the query.
*
* @return array A tuple with the first element being the SQL string and the second
* element being the ResultSetMapping.
*
* @throws ORMException * @throws ORMException
* @return array A tuple with the first element being the SQL string and the second
* element being the ResultSetMapping.
*/ */
public function getNamedNativeQuery($name) public function getNamedNativeQuery($name)
{ {
@ -338,6 +369,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Ensures that this Configuration instance contains settings that are * Ensures that this Configuration instance contains settings that are
* suitable for a production environment. * suitable for a production environment.
* *
* @return void
*
* @throws ORMException If a configuration setting has a value that is not * @throws ORMException If a configuration setting has a value that is not
* suitable for a production environment. * suitable for a production environment.
*/ */
@ -365,6 +398,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
* *
* @param string $name * @param string $name
* @param string $className * @param string $className
*
* @return void
*
* @throws ORMException * @throws ORMException
*/ */
public function addCustomStringFunction($name, $className) public function addCustomStringFunction($name, $className)
@ -380,7 +416,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Gets the implementation class name of a registered custom string DQL function. * Gets the implementation class name of a registered custom string DQL function.
* *
* @param string $name * @param string $name
* @return string *
* @return string|null
*/ */
public function getCustomStringFunction($name) public function getCustomStringFunction($name)
{ {
@ -400,6 +437,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Any previously added string functions are discarded. * Any previously added string functions are discarded.
* *
* @param array $functions The map of custom DQL string functions. * @param array $functions The map of custom DQL string functions.
*
* @return void
*/ */
public function setCustomStringFunctions(array $functions) public function setCustomStringFunctions(array $functions)
{ {
@ -417,6 +456,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
* *
* @param string $name * @param string $name
* @param string $className * @param string $className
*
* @return void
*
* @throws ORMException * @throws ORMException
*/ */
public function addCustomNumericFunction($name, $className) public function addCustomNumericFunction($name, $className)
@ -432,7 +474,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Gets the implementation class name of a registered custom numeric DQL function. * Gets the implementation class name of a registered custom numeric DQL function.
* *
* @param string $name * @param string $name
* @return string *
* @return string|null
*/ */
public function getCustomNumericFunction($name) public function getCustomNumericFunction($name)
{ {
@ -452,6 +495,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Any previously added numeric functions are discarded. * Any previously added numeric functions are discarded.
* *
* @param array $functions The map of custom DQL numeric functions. * @param array $functions The map of custom DQL numeric functions.
*
* @return void
*/ */
public function setCustomNumericFunctions(array $functions) public function setCustomNumericFunctions(array $functions)
{ {
@ -469,6 +514,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
* *
* @param string $name * @param string $name
* @param string $className * @param string $className
*
* @return void
*
* @throws ORMException * @throws ORMException
*/ */
public function addCustomDatetimeFunction($name, $className) public function addCustomDatetimeFunction($name, $className)
@ -484,7 +532,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Gets the implementation class name of a registered custom date/time DQL function. * Gets the implementation class name of a registered custom date/time DQL function.
* *
* @param string $name * @param string $name
* @return string *
* @return string|null
*/ */
public function getCustomDatetimeFunction($name) public function getCustomDatetimeFunction($name)
{ {
@ -504,6 +553,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Any previously added date/time functions are discarded. * Any previously added date/time functions are discarded.
* *
* @param array $functions The map of custom DQL date/time functions. * @param array $functions The map of custom DQL date/time functions.
*
* @return void
*/ */
public function setCustomDatetimeFunctions(array $functions) public function setCustomDatetimeFunctions(array $functions)
{ {
@ -513,9 +564,11 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set the custom hydrator modes in one pass. * Sets the custom hydrator modes in one pass.
* *
* @param array An array of ($modeName => $hydrator) * @param array $modes An array of ($modeName => $hydrator).
*
* @return void
*/ */
public function setCustomHydrationModes($modes) public function setCustomHydrationModes($modes)
{ {
@ -527,10 +580,11 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Get the hydrator class for the given hydration mode name. * Gets the hydrator class for the given hydration mode name.
* *
* @param string $modeName The hydration mode name. * @param string $modeName The hydration mode name.
* @return string $hydrator The hydrator class name. *
* @return string|null The hydrator class name.
*/ */
public function getCustomHydrationMode($modeName) public function getCustomHydrationMode($modeName)
{ {
@ -540,10 +594,12 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Add a custom hydration mode. * Adds a custom hydration mode.
* *
* @param string $modeName The hydration mode name. * @param string $modeName The hydration mode name.
* @param string $hydrator The hydrator class name. * @param string $hydrator The hydrator class name.
*
* @return void
*/ */
public function addCustomHydrationMode($modeName, $hydrator) public function addCustomHydrationMode($modeName, $hydrator)
{ {
@ -551,9 +607,11 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set a class metadata factory. * Sets a class metadata factory.
* *
* @param string $cmfName * @param string $cmfName
*
* @return void
*/ */
public function setClassMetadataFactoryName($cmfName) public function setClassMetadataFactoryName($cmfName)
{ {
@ -573,11 +631,12 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Add a filter to the list of possible filters. * Adds a filter to the list of possible filters.
* *
* @param string $name The name of the filter. * @param string $name The name of the filter.
* @param string|Query\Filter\SQLFilter $filter The filter class name or an * @param string|Query\Filter\SQLFilter $filter The filter class name or an SQLFilter instance.
* SQLFilter instance. *
* @return void
* *
* @throws \InvalidArgumentException If the filter is an object and it doesn't * @throws \InvalidArgumentException If the filter is an object and it doesn't
* extend the Query\Filter\SQLFilter class. * extend the Query\Filter\SQLFilter class.
@ -599,8 +658,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* *
* @param string $name The name of the filter. * @param string $name The name of the filter.
* *
* @return string|Query\Filter\SQLFilter The class name of the filter, an * @return null|string|Query\Filter\SQLFilter The class name of the filter, an
* SQLFilter instance or null of it is not defined. * SQLFilter instance or null of it is not defined.
*/ */
public function getFilter($name) public function getFilter($name)
{ {
@ -610,10 +669,14 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set default repository class. * Sets default repository class.
* *
* @since 2.2 * @since 2.2
*
* @param string $className * @param string $className
*
* @return void
*
* @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository * @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository
*/ */
public function setDefaultRepositoryClassName($className) public function setDefaultRepositoryClassName($className)
@ -631,6 +694,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Get default repository class. * Get default repository class.
* *
* @since 2.2 * @since 2.2
*
* @return string * @return string
*/ */
public function getDefaultRepositoryClassName() public function getDefaultRepositoryClassName()
@ -641,10 +705,13 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set naming strategy. * Sets naming strategy.
* *
* @since 2.3 * @since 2.3
*
* @param NamingStrategy $namingStrategy * @param NamingStrategy $namingStrategy
*
* @return void
*/ */
public function setNamingStrategy(NamingStrategy $namingStrategy) public function setNamingStrategy(NamingStrategy $namingStrategy)
{ {
@ -652,9 +719,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Get naming strategy.. * Gets naming strategy..
* *
* @since 2.3 * @since 2.3
*
* @return NamingStrategy * @return NamingStrategy
*/ */
public function getNamingStrategy() public function getNamingStrategy()
@ -667,10 +735,13 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set quote strategy. * Sets quote strategy.
* *
* @since 2.3 * @since 2.3
*
* @param \Doctrine\ORM\Mapping\QuoteStrategy $quoteStrategy * @param \Doctrine\ORM\Mapping\QuoteStrategy $quoteStrategy
*
* @return void
*/ */
public function setQuoteStrategy(QuoteStrategy $quoteStrategy) public function setQuoteStrategy(QuoteStrategy $quoteStrategy)
{ {
@ -678,9 +749,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Get quote strategy. * Gets quote strategy.
* *
* @since 2.3 * @since 2.3
*
* @return \Doctrine\ORM\Mapping\QuoteStrategy * @return \Doctrine\ORM\Mapping\QuoteStrategy
*/ */
public function getQuoteStrategy() public function getQuoteStrategy()

View File

@ -123,8 +123,8 @@ class EntityManager implements ObjectManager
* Creates a new EntityManager that operates on the given database connection * Creates a new EntityManager that operates on the given database connection
* and uses the given Configuration and EventManager implementations. * and uses the given Configuration and EventManager implementations.
* *
* @param \Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @param \Doctrine\ORM\Configuration $config * @param \Doctrine\ORM\Configuration $config
* @param \Doctrine\Common\EventManager $eventManager * @param \Doctrine\Common\EventManager $eventManager
*/ */
protected function __construct(Connection $conn, Configuration $config, EventManager $eventManager) protected function __construct(Connection $conn, Configuration $config, EventManager $eventManager)
@ -193,6 +193,8 @@ class EntityManager implements ObjectManager
/** /**
* Starts a transaction on the underlying database connection. * Starts a transaction on the underlying database connection.
*
* @return void
*/ */
public function beginTransaction() public function beginTransaction()
{ {
@ -210,7 +212,8 @@ class EntityManager implements ObjectManager
* the transaction is rolled back, the EntityManager closed and the exception re-thrown. * the transaction is rolled back, the EntityManager closed and the exception re-thrown.
* *
* @param callable $func The function to execute transactionally. * @param callable $func The function to execute transactionally.
* @return mixed Returns the non-empty value returned from the closure or true instead *
* @return mixed The non-empty value returned from the closure or true instead.
*/ */
public function transactional($func) public function transactional($func)
{ {
@ -237,6 +240,8 @@ class EntityManager implements ObjectManager
/** /**
* Commits a transaction on the underlying database connection. * Commits a transaction on the underlying database connection.
*
* @return void
*/ */
public function commit() public function commit()
{ {
@ -245,6 +250,8 @@ class EntityManager implements ObjectManager
/** /**
* Performs a rollback on the underlying database connection. * Performs a rollback on the underlying database connection.
*
* @return void
*/ */
public function rollback() public function rollback()
{ {
@ -261,7 +268,10 @@ class EntityManager implements ObjectManager
* MyProject\Domain\User * MyProject\Domain\User
* sales:PriceRequest * sales:PriceRequest
* *
* @param string $className
*
* @return \Doctrine\ORM\Mapping\ClassMetadata * @return \Doctrine\ORM\Mapping\ClassMetadata
*
* @internal Performance-sensitive method. * @internal Performance-sensitive method.
*/ */
public function getClassMetadata($className) public function getClassMetadata($className)
@ -273,6 +283,7 @@ class EntityManager implements ObjectManager
* Creates a new Query object. * Creates a new Query object.
* *
* @param string $dql The DQL string. * @param string $dql The DQL string.
*
* @return \Doctrine\ORM\Query * @return \Doctrine\ORM\Query
*/ */
public function createQuery($dql = "") public function createQuery($dql = "")
@ -290,6 +301,7 @@ class EntityManager implements ObjectManager
* Creates a Query from a named query. * Creates a Query from a named query.
* *
* @param string $name * @param string $name
*
* @return \Doctrine\ORM\Query * @return \Doctrine\ORM\Query
*/ */
public function createNamedQuery($name) public function createNamedQuery($name)
@ -300,8 +312,9 @@ class EntityManager implements ObjectManager
/** /**
* Creates a native SQL query. * Creates a native SQL query.
* *
* @param string $sql * @param string $sql
* @param ResultSetMapping $rsm The ResultSetMapping to use. * @param ResultSetMapping $rsm The ResultSetMapping to use.
*
* @return NativeQuery * @return NativeQuery
*/ */
public function createNativeQuery($sql, ResultSetMapping $rsm) public function createNativeQuery($sql, ResultSetMapping $rsm)
@ -318,6 +331,7 @@ class EntityManager implements ObjectManager
* Creates a NativeQuery from a named native query. * Creates a NativeQuery from a named native query.
* *
* @param string $name * @param string $name
*
* @return \Doctrine\ORM\NativeQuery * @return \Doctrine\ORM\NativeQuery
*/ */
public function createNamedNativeQuery($name) public function createNamedNativeQuery($name)
@ -330,7 +344,7 @@ class EntityManager implements ObjectManager
/** /**
* Create a QueryBuilder instance * Create a QueryBuilder instance
* *
* @return QueryBuilder $qb * @return QueryBuilder
*/ */
public function createQueryBuilder() public function createQueryBuilder()
{ {
@ -346,6 +360,9 @@ class EntityManager implements ObjectManager
* the cascade-persist semantics + scheduled inserts/removals are synchronized. * the cascade-persist semantics + scheduled inserts/removals are synchronized.
* *
* @param object $entity * @param object $entity
*
* @return void
*
* @throws \Doctrine\ORM\OptimisticLockException If a version check on an entity that * @throws \Doctrine\ORM\OptimisticLockException If a version check on an entity that
* makes use of optimistic locking fails. * makes use of optimistic locking fails.
*/ */
@ -359,12 +376,17 @@ class EntityManager implements ObjectManager
/** /**
* Finds an Entity by its identifier. * Finds an Entity by its identifier.
* *
* @param string $entityName * @param string $entityName
* @param mixed $id * @param mixed $id
* @param integer $lockMode * @param integer $lockMode
* @param integer $lockVersion * @param integer $lockVersion
* *
* @return object * @return object
*
* @throws OptimisticLockException
* @throws ORMInvalidArgumentException
* @throws TransactionRequiredException
* @throws ORMException
*/ */
public function find($entityName, $id, $lockMode = LockMode::NONE, $lockVersion = null) public function find($entityName, $id, $lockMode = LockMode::NONE, $lockVersion = null)
{ {
@ -446,8 +468,11 @@ class EntityManager implements ObjectManager
* without actually loading it, if the entity is not yet loaded. * without actually loading it, if the entity is not yet loaded.
* *
* @param string $entityName The name of the entity type. * @param string $entityName The name of the entity type.
* @param mixed $id The entity identifier. * @param mixed $id The entity identifier.
*
* @return object The entity reference. * @return object The entity reference.
*
* @throws ORMException
*/ */
public function getReference($entityName, $id) public function getReference($entityName, $id)
{ {
@ -503,7 +528,8 @@ class EntityManager implements ObjectManager
* never be loaded in the first place. * never be loaded in the first place.
* *
* @param string $entityName The name of the entity type. * @param string $entityName The name of the entity type.
* @param mixed $identifier The entity identifier. * @param mixed $identifier The entity identifier.
*
* @return object The (partial) entity reference. * @return object The (partial) entity reference.
*/ */
public function getPartialReference($entityName, $identifier) public function getPartialReference($entityName, $identifier)
@ -533,7 +559,9 @@ class EntityManager implements ObjectManager
* Clears the EntityManager. All entities that are currently managed * Clears the EntityManager. All entities that are currently managed
* by this EntityManager become detached. * by this EntityManager become detached.
* *
* @param string $entityName if given, only entities of this type will get detached * @param string|null $entityName if given, only entities of this type will get detached
*
* @return void
*/ */
public function clear($entityName = null) public function clear($entityName = null)
{ {
@ -544,6 +572,8 @@ class EntityManager implements ObjectManager
* Closes the EntityManager. All entities that are currently managed * Closes the EntityManager. All entities that are currently managed
* by this EntityManager become detached. The EntityManager may no longer * by this EntityManager become detached. The EntityManager may no longer
* be used after it is closed. * be used after it is closed.
*
* @return void
*/ */
public function close() public function close()
{ {
@ -561,7 +591,11 @@ class EntityManager implements ObjectManager
* NOTE: The persist operation always considers entities that are not yet known to * NOTE: The persist operation always considers entities that are not yet known to
* this EntityManager as NEW. Do not pass detached entities to the persist operation. * this EntityManager as NEW. Do not pass detached entities to the persist operation.
* *
* @param object $object The instance to make managed and persistent. * @param object $entity The instance to make managed and persistent.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/ */
public function persist($entity) public function persist($entity)
{ {
@ -581,6 +615,10 @@ class EntityManager implements ObjectManager
* or as a result of the flush operation. * or as a result of the flush operation.
* *
* @param object $entity The entity instance to remove. * @param object $entity The entity instance to remove.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/ */
public function remove($entity) public function remove($entity)
{ {
@ -598,6 +636,10 @@ class EntityManager implements ObjectManager
* overriding any local changes that have not yet been persisted. * overriding any local changes that have not yet been persisted.
* *
* @param object $entity The entity to refresh. * @param object $entity The entity to refresh.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/ */
public function refresh($entity) public function refresh($entity)
{ {
@ -618,6 +660,10 @@ class EntityManager implements ObjectManager
* reference it. * reference it.
* *
* @param object $entity The entity to detach. * @param object $entity The entity to detach.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/ */
public function detach($entity) public function detach($entity)
{ {
@ -634,7 +680,10 @@ class EntityManager implements ObjectManager
* The entity passed to merge will not become associated/managed with this EntityManager. * The entity passed to merge will not become associated/managed with this EntityManager.
* *
* @param object $entity The detached entity to merge into the persistence context. * @param object $entity The detached entity to merge into the persistence context.
*
* @return object The managed copy of the entity. * @return object The managed copy of the entity.
*
* @throws ORMInvalidArgumentException
*/ */
public function merge($entity) public function merge($entity)
{ {
@ -650,8 +699,13 @@ class EntityManager implements ObjectManager
/** /**
* Creates a copy of the given entity. Can create a shallow or a deep copy. * Creates a copy of the given entity. Can create a shallow or a deep copy.
* *
* @param object $entity The entity to copy. * @param object $entity The entity to copy.
* @return object The new entity. * @param boolean $deep FALSE for a shallow copy, TRUE for a deep copy.
*
* @return object The new entity.
*
* @throws \BadMethodCallException
*
* @todo Implementation need. This is necessary since $e2 = clone $e1; throws an E_FATAL when access anything on $e: * @todo Implementation need. This is necessary since $e2 = clone $e1; throws an E_FATAL when access anything on $e:
* Fatal error: Maximum function nesting level of '100' reached, aborting! * Fatal error: Maximum function nesting level of '100' reached, aborting!
*/ */
@ -663,9 +717,12 @@ class EntityManager implements ObjectManager
/** /**
* Acquire a lock on the given entity. * Acquire a lock on the given entity.
* *
* @param object $entity * @param object $entity
* @param int $lockMode * @param int $lockMode
* @param int $lockVersion * @param int|null $lockVersion
*
* @return void
*
* @throws OptimisticLockException * @throws OptimisticLockException
* @throws PessimisticLockException * @throws PessimisticLockException
*/ */
@ -678,6 +735,7 @@ class EntityManager implements ObjectManager
* Gets the repository for an entity class. * Gets the repository for an entity class.
* *
* @param string $entityName The name of the entity. * @param string $entityName The name of the entity.
*
* @return EntityRepository The repository class. * @return EntityRepository The repository class.
*/ */
public function getRepository($entityName) public function getRepository($entityName)
@ -706,6 +764,7 @@ class EntityManager implements ObjectManager
* Determines whether an entity instance is managed in this EntityManager. * Determines whether an entity instance is managed in this EntityManager.
* *
* @param object $entity * @param object $entity
*
* @return boolean TRUE if this EntityManager currently manages the given entity, FALSE otherwise. * @return boolean TRUE if this EntityManager currently manages the given entity, FALSE otherwise.
*/ */
public function contains($entity) public function contains($entity)
@ -738,6 +797,8 @@ class EntityManager implements ObjectManager
/** /**
* Throws an exception if the EntityManager is closed or currently not active. * Throws an exception if the EntityManager is closed or currently not active.
* *
* @return void
*
* @throws ORMException If the EntityManager is closed. * @throws ORMException If the EntityManager is closed.
*/ */
private function errorIfClosed() private function errorIfClosed()
@ -774,6 +835,7 @@ class EntityManager implements ObjectManager
* selectively iterate over the result. * selectively iterate over the result.
* *
* @param int $hydrationMode * @param int $hydrationMode
*
* @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
*/ */
public function getHydrator($hydrationMode) public function getHydrator($hydrationMode)
@ -788,8 +850,11 @@ class EntityManager implements ObjectManager
/** /**
* Create a new instance for the given hydration mode. * Create a new instance for the given hydration mode.
* *
* @param int $hydrationMode * @param int $hydrationMode
*
* @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
*
* @throws ORMException
*/ */
public function newHydrator($hydrationMode) public function newHydrator($hydrationMode)
{ {
@ -834,6 +899,8 @@ class EntityManager implements ObjectManager
* This method is a no-op for other objects * This method is a no-op for other objects
* *
* @param object $obj * @param object $obj
*
* @return void
*/ */
public function initializeObject($obj) public function initializeObject($obj)
{ {
@ -843,11 +910,14 @@ class EntityManager implements ObjectManager
/** /**
* Factory method to create EntityManager instances. * Factory method to create EntityManager instances.
* *
* @param mixed $conn An array with the connection parameters or an existing * @param mixed $conn An array with the connection parameters or an existing Connection instance.
* Connection instance. * @param Configuration $config The Configuration instance to use.
* @param Configuration $config The Configuration instance to use. * @param EventManager $eventManager The EventManager instance to use.
* @param EventManager $eventManager The EventManager instance to use. *
* @return EntityManager The created EntityManager. * @return EntityManager The created EntityManager.
*
* @throws \InvalidArgumentException
* @throws ORMException
*/ */
public static function create($conn, Configuration $config, EventManager $eventManager = null) public static function create($conn, Configuration $config, EventManager $eventManager = null)
{ {
@ -902,7 +972,7 @@ class EntityManager implements ObjectManager
/** /**
* Checks whether the Entity Manager has filters. * Checks whether the Entity Manager has filters.
* *
* @return True, if the EM has a filter collection. * @return boolean True, if the EM has a filter collection.
*/ */
public function hasFilters() public function hasFilters()
{ {

View File

@ -27,6 +27,9 @@ namespace Doctrine\ORM;
*/ */
class EntityNotFoundException extends ORMException class EntityNotFoundException extends ORMException
{ {
/**
* Constructor.
*/
public function __construct() public function __construct()
{ {
parent::__construct('Entity was not found.'); parent::__construct('Entity was not found.');

View File

@ -61,8 +61,8 @@ class EntityRepository implements ObjectRepository, Selectable
/** /**
* Initializes a new <tt>EntityRepository</tt>. * Initializes a new <tt>EntityRepository</tt>.
* *
* @param EntityManager $em The EntityManager to use. * @param EntityManager $em The EntityManager to use.
* @param Mapping\ClassMetadata $classMetadata The class descriptor. * @param Mapping\ClassMetadata $class The class descriptor.
*/ */
public function __construct($em, Mapping\ClassMetadata $class) public function __construct($em, Mapping\ClassMetadata $class)
{ {
@ -72,10 +72,11 @@ class EntityRepository implements ObjectRepository, Selectable
} }
/** /**
* Create a new QueryBuilder instance that is prepopulated for this entity name * Creates a new QueryBuilder instance that is prepopulated for this entity name.
* *
* @param string $alias * @param string $alias
* @return QueryBuilder $qb *
* @return QueryBuilder
*/ */
public function createQueryBuilder($alias) public function createQueryBuilder($alias)
{ {
@ -85,11 +86,12 @@ class EntityRepository implements ObjectRepository, Selectable
} }
/** /**
* Create a new result set mapping builder for this entity. * Creates a new result set mapping builder for this entity.
* *
* The column naming strategy is "INCREMENT". * The column naming strategy is "INCREMENT".
* *
* @param string $alias * @param string $alias
*
* @return ResultSetMappingBuilder * @return ResultSetMappingBuilder
*/ */
public function createResultSetMappingBuilder($alias) public function createResultSetMappingBuilder($alias)
@ -101,9 +103,10 @@ class EntityRepository implements ObjectRepository, Selectable
} }
/** /**
* Create a new Query instance based on a predefined metadata named query. * Creates a new Query instance based on a predefined metadata named query.
* *
* @param string $queryName * @param string $queryName
*
* @return Query * @return Query
*/ */
public function createNamedQuery($queryName) public function createNamedQuery($queryName)
@ -115,6 +118,7 @@ class EntityRepository implements ObjectRepository, Selectable
* Creates a native SQL query. * Creates a native SQL query.
* *
* @param string $queryName * @param string $queryName
*
* @return NativeQuery * @return NativeQuery
*/ */
public function createNativeNamedQuery($queryName) public function createNativeNamedQuery($queryName)
@ -128,6 +132,8 @@ class EntityRepository implements ObjectRepository, Selectable
/** /**
* Clears the repository, causing all managed entities to become detached. * Clears the repository, causing all managed entities to become detached.
*
* @return void
*/ */
public function clear() public function clear()
{ {
@ -137,9 +143,9 @@ class EntityRepository implements ObjectRepository, Selectable
/** /**
* Finds an entity by its primary key / identifier. * Finds an entity by its primary key / identifier.
* *
* @param mixed $id The identifier. * @param mixed $id The identifier.
* @param integer $lockMode * @param int $lockMode The lock mode.
* @param integer $lockVersion * @param int|null $lockVersion The lock version.
* *
* @return object The entity. * @return object The entity.
*/ */
@ -161,10 +167,11 @@ class EntityRepository implements ObjectRepository, Selectable
/** /**
* Finds entities by a set of criteria. * Finds entities by a set of criteria.
* *
* @param array $criteria * @param array $criteria
* @param array|null $orderBy * @param array|null $orderBy
* @param int|null $limit * @param int|null $limit
* @param int|null $offset * @param int|null $offset
*
* @return array The objects. * @return array The objects.
*/ */
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
@ -179,6 +186,7 @@ class EntityRepository implements ObjectRepository, Selectable
* *
* @param array $criteria * @param array $criteria
* @param array|null $orderBy * @param array|null $orderBy
*
* @return object * @return object
*/ */
public function findOneBy(array $criteria, array $orderBy = null) public function findOneBy(array $criteria, array $orderBy = null)
@ -191,8 +199,13 @@ class EntityRepository implements ObjectRepository, Selectable
/** /**
* Adds support for magic finders. * Adds support for magic finders.
* *
* @param string $method
* @param array $arguments
*
* @return array|object The found entity/entities. * @return array|object The found entity/entities.
* @throws BadMethodCallException If the method called is an invalid find* method *
* @throws ORMException
* @throws \BadMethodCallException If the method called is an invalid find* method
* or no find* method at all and therefore an invalid * or no find* method at all and therefore an invalid
* method call. * method call.
*/ */
@ -291,4 +304,3 @@ class EntityRepository implements ObjectRepository, Selectable
return new ArrayCollection($persister->loadCriteria($criteria)); return new ArrayCollection($persister->loadCriteria($criteria));
} }
} }

View File

@ -44,10 +44,10 @@ class LifecycleEventArgs extends EventArgs
private $entity; private $entity;
/** /**
* Constructor * Constructor.
* *
* @param object $entity * @param object $entity
* @param \Doctrine\ORM\EntityManager $em * @param EntityManager $em
*/ */
public function __construct($entity, EntityManager $em) public function __construct($entity, EntityManager $em)
{ {
@ -56,7 +56,7 @@ class LifecycleEventArgs extends EventArgs
} }
/** /**
* Retrieve associated Entity. * Retrieves associated Entity.
* *
* @return object * @return object
*/ */
@ -66,7 +66,7 @@ class LifecycleEventArgs extends EventArgs
} }
/** /**
* Retrieve associated EntityManager. * Retrieves associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */

View File

@ -44,8 +44,8 @@ class LoadClassMetadataEventArgs extends EventArgs
/** /**
* Constructor. * Constructor.
* *
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata * @param ClassMetadataInfo $classMetadata
* @param \Doctrine\ORM\EntityManager $em * @param EntityManager $em
*/ */
public function __construct(ClassMetadataInfo $classMetadata, EntityManager $em) public function __construct(ClassMetadataInfo $classMetadata, EntityManager $em)
{ {
@ -54,7 +54,7 @@ class LoadClassMetadataEventArgs extends EventArgs
} }
/** /**
* Retrieve associated ClassMetadata. * Retrieves associated ClassMetadata.
* *
* @return \Doctrine\ORM\Mapping\ClassMetadataInfo * @return \Doctrine\ORM\Mapping\ClassMetadataInfo
*/ */
@ -64,7 +64,7 @@ class LoadClassMetadataEventArgs extends EventArgs
} }
/** /**
* Retrieve associated EntityManager. * Retrieves associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */
@ -73,4 +73,3 @@ class LoadClassMetadataEventArgs extends EventArgs
return $this->em; return $this->em;
} }
} }

View File

@ -44,7 +44,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
* Constructor. * Constructor.
* *
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
* @param string $entityClass Optional entity class * @param string|null $entityClass Optional entity class.
*/ */
public function __construct($em, $entityClass = null) public function __construct($em, $entityClass = null)
{ {
@ -53,7 +53,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
} }
/** /**
* Retrieve associated EntityManager. * Retrieves associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */
@ -65,7 +65,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
/** /**
* Name of the entity class that is cleared, or empty if all are cleared. * Name of the entity class that is cleared, or empty if all are cleared.
* *
* @return string * @return string|null
*/ */
public function getEntityClass() public function getEntityClass()
{ {
@ -73,7 +73,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
} }
/** /**
* Check if event clears all entities. * Checks if event clears all entities.
* *
* @return bool * @return bool
*/ */

View File

@ -47,7 +47,7 @@ class PostFlushEventArgs extends EventArgs
} }
/** /**
* Retrieve associated EntityManager. * Retrieves associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */

View File

@ -35,6 +35,11 @@ class PreFlushEventArgs extends \Doctrine\Common\EventArgs
*/ */
private $_em; private $_em;
/**
* Constructor.
*
* @param \Doctrine\ORM\EntityManager $em
*/
public function __construct($em) public function __construct($em)
{ {
$this->_em = $em; $this->_em = $em;

View File

@ -40,9 +40,9 @@ class PreUpdateEventArgs extends LifecycleEventArgs
/** /**
* Constructor. * Constructor.
* *
* @param object $entity * @param object $entity
* @param \Doctrine\ORM\EntityManager $em * @param EntityManager $em
* @param array $changeSet * @param array $changeSet
*/ */
public function __construct($entity, EntityManager $em, array &$changeSet) public function __construct($entity, EntityManager $em, array &$changeSet)
{ {
@ -52,7 +52,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs
} }
/** /**
* Retrieve entity changeset. * Retrieves entity changeset.
* *
* @return array * @return array
*/ */
@ -62,7 +62,9 @@ class PreUpdateEventArgs extends LifecycleEventArgs
} }
/** /**
* Check if field has a changeset. * Checks if field has a changeset.
*
* @param string $field
* *
* @return boolean * @return boolean
*/ */
@ -72,9 +74,10 @@ class PreUpdateEventArgs extends LifecycleEventArgs
} }
/** /**
* Get the old value of the changeset of the changed field. * Gets the old value of the changeset of the changed field.
*
* @param string $field
* *
* @param string $field
* @return mixed * @return mixed
*/ */
public function getOldValue($field) public function getOldValue($field)
@ -85,9 +88,10 @@ class PreUpdateEventArgs extends LifecycleEventArgs
} }
/** /**
* Get the new value of the changeset of the changed field. * Gets the new value of the changeset of the changed field.
*
* @param string $field
* *
* @param string $field
* @return mixed * @return mixed
*/ */
public function getNewValue($field) public function getNewValue($field)
@ -98,10 +102,12 @@ class PreUpdateEventArgs extends LifecycleEventArgs
} }
/** /**
* Set the new value of this field. * Sets the new value of this field.
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
*
* @return void
*/ */
public function setNewValue($field, $value) public function setNewValue($field, $value)
{ {
@ -111,9 +117,13 @@ class PreUpdateEventArgs extends LifecycleEventArgs
} }
/** /**
* Assert the field exists in changeset. * Asserts the field exists in changeset.
* *
* @param string $field * @param string $field
*
* @return void
*
* @throws \InvalidArgumentException
*/ */
private function assertValidField($field) private function assertValidField($field)
{ {
@ -126,4 +136,3 @@ class PreUpdateEventArgs extends LifecycleEventArgs
} }
} }
} }

View File

@ -29,7 +29,13 @@ namespace Doctrine\ORM;
*/ */
final class Events final class Events
{ {
private function __construct() {} /**
* Private constructor. This class is not meant to be instantiated.
*/
private function __construct()
{
}
/** /**
* The preRemove event occurs for a given entity before the respective * The preRemove event occurs for a given entity before the respective
* EntityManager remove operation for that entity is executed. * EntityManager remove operation for that entity is executed.
@ -39,6 +45,7 @@ final class Events
* @var string * @var string
*/ */
const preRemove = 'preRemove'; const preRemove = 'preRemove';
/** /**
* The postRemove event occurs for an entity after the entity has * The postRemove event occurs for an entity after the entity has
* been deleted. It will be invoked after the database delete operations. * been deleted. It will be invoked after the database delete operations.
@ -48,6 +55,7 @@ final class Events
* @var string * @var string
*/ */
const postRemove = 'postRemove'; const postRemove = 'postRemove';
/** /**
* The prePersist event occurs for a given entity before the respective * The prePersist event occurs for a given entity before the respective
* EntityManager persist operation for that entity is executed. * EntityManager persist operation for that entity is executed.
@ -57,6 +65,7 @@ final class Events
* @var string * @var string
*/ */
const prePersist = 'prePersist'; const prePersist = 'prePersist';
/** /**
* The postPersist event occurs for an entity after the entity has * The postPersist event occurs for an entity after the entity has
* been made persistent. It will be invoked after the database insert operations. * been made persistent. It will be invoked after the database insert operations.
@ -67,6 +76,7 @@ final class Events
* @var string * @var string
*/ */
const postPersist = 'postPersist'; const postPersist = 'postPersist';
/** /**
* The preUpdate event occurs before the database update operations to * The preUpdate event occurs before the database update operations to
* entity data. * entity data.
@ -76,6 +86,7 @@ final class Events
* @var string * @var string
*/ */
const preUpdate = 'preUpdate'; const preUpdate = 'preUpdate';
/** /**
* The postUpdate event occurs after the database update operations to * The postUpdate event occurs after the database update operations to
* entity data. * entity data.
@ -85,6 +96,7 @@ final class Events
* @var string * @var string
*/ */
const postUpdate = 'postUpdate'; const postUpdate = 'postUpdate';
/** /**
* The postLoad event occurs for an entity after the entity has been loaded * The postLoad event occurs for an entity after the entity has been loaded
* into the current EntityManager from the database or after the refresh operation * into the current EntityManager from the database or after the refresh operation
@ -99,6 +111,7 @@ final class Events
* @var string * @var string
*/ */
const postLoad = 'postLoad'; const postLoad = 'postLoad';
/** /**
* The loadClassMetadata event occurs after the mapping metadata for a class * The loadClassMetadata event occurs after the mapping metadata for a class
* has been loaded from a mapping source (annotations/xml/yaml). * has been loaded from a mapping source (annotations/xml/yaml).

View File

@ -26,7 +26,9 @@ abstract class AbstractIdGenerator
/** /**
* Generates an identifier for an entity. * Generates an identifier for an entity.
* *
* @param \Doctrine\ORM\EntityManager $em
* @param \Doctrine\ORM\Mapping\Entity $entity * @param \Doctrine\ORM\Mapping\Entity $entity
*
* @return mixed * @return mixed
*/ */
abstract public function generate(EntityManager $em, $entity); abstract public function generate(EntityManager $em, $entity);

View File

@ -36,8 +36,13 @@ class AssignedGenerator extends AbstractIdGenerator
/** /**
* Returns the identifier assigned to the given entity. * Returns the identifier assigned to the given entity.
* *
* @param object $entity * @param EntityManager $em
* @param object $entity
*
* @return mixed * @return mixed
*
* @throws \Doctrine\ORM\ORMException
*
* @override * @override
*/ */
public function generate(EntityManager $em, $entity) public function generate(EntityManager $em, $entity)

View File

@ -28,13 +28,19 @@ use Doctrine\ORM\EntityManager;
*/ */
class IdentityGenerator extends AbstractIdGenerator class IdentityGenerator extends AbstractIdGenerator
{ {
/** @var string The name of the sequence to pass to lastInsertId(), if any. */ /**
* The name of the sequence to pass to lastInsertId(), if any.
*
* @var string
*/
private $_seqName; private $_seqName;
/** /**
* @param string $seqName The name of the sequence to pass to lastInsertId() * Constructor.
* to obtain the last generated identifier within the current *
* database session/connection, if any. * @param string|null $seqName The name of the sequence to pass to lastInsertId()
* to obtain the last generated identifier within the current
* database session/connection, if any.
*/ */
public function __construct($seqName = null) public function __construct($seqName = null)
{ {

View File

@ -30,16 +30,34 @@ use Doctrine\ORM\EntityManager;
*/ */
class SequenceGenerator extends AbstractIdGenerator implements Serializable class SequenceGenerator extends AbstractIdGenerator implements Serializable
{ {
/**
* The allocation size of the sequence.
*
* @var int
*/
private $_allocationSize; private $_allocationSize;
/**
* The name of the sequence.
*
* @var string
*/
private $_sequenceName; private $_sequenceName;
/**
* @var int
*/
private $_nextValue = 0; private $_nextValue = 0;
/**
* @var int|null
*/
private $_maxValue = null; private $_maxValue = null;
/** /**
* Initializes a new sequence generator. * Initializes a new sequence generator.
* *
* @param \Doctrine\ORM\EntityManager $em The EntityManager to use. * @param string $sequenceName The name of the sequence.
* @param string $sequenceName The name of the sequence.
* @param integer $allocationSize The allocation size of the sequence. * @param integer $allocationSize The allocation size of the sequence.
*/ */
public function __construct($sequenceName, $allocationSize) public function __construct($sequenceName, $allocationSize)
@ -51,8 +69,11 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
/** /**
* Generates an ID for the given entity. * Generates an ID for the given entity.
* *
* @param object $entity * @param EntityManager $em
* @return integer|float The generated value. * @param object $entity
*
* @return integer The generated value.
*
* @override * @override
*/ */
public function generate(EntityManager $em, $entity) public function generate(EntityManager $em, $entity)
@ -72,7 +93,7 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
/** /**
* Gets the maximum value of the currently allocated bag of values. * Gets the maximum value of the currently allocated bag of values.
* *
* @return integer|float * @return integer|null
*/ */
public function getCurrentMaxValue() public function getCurrentMaxValue()
{ {
@ -82,13 +103,16 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
/** /**
* Gets the next value that will be returned by generate(). * Gets the next value that will be returned by generate().
* *
* @return integer|float * @return integer
*/ */
public function getNextValue() public function getNextValue()
{ {
return $this->_nextValue; return $this->_nextValue;
} }
/**
* @return string
*/
public function serialize() public function serialize()
{ {
return serialize(array( return serialize(array(
@ -97,6 +121,11 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
)); ));
} }
/**
* @param string $serialized
*
* @return void
*/
public function unserialize($serialized) public function unserialize($serialized)
{ {
$array = unserialize($serialized); $array = unserialize($serialized);

View File

@ -32,12 +32,36 @@ use Doctrine\ORM\EntityManager;
*/ */
class TableGenerator extends AbstractIdGenerator class TableGenerator extends AbstractIdGenerator
{ {
/**
* @var string
*/
private $_tableName; private $_tableName;
/**
* @var string
*/
private $_sequenceName; private $_sequenceName;
/**
* @var int
*/
private $_allocationSize; private $_allocationSize;
/**
* @var int|null
*/
private $_nextValue; private $_nextValue;
/**
* @var int|null
*/
private $_maxValue; private $_maxValue;
/**
* @param string $tableName
* @param string $sequenceName
* @param int $allocationSize
*/
public function __construct($tableName, $sequenceName = 'default', $allocationSize = 10) public function __construct($tableName, $sequenceName = 'default', $allocationSize = 10)
{ {
$this->_tableName = $tableName; $this->_tableName = $tableName;
@ -45,6 +69,9 @@ class TableGenerator extends AbstractIdGenerator
$this->_allocationSize = $allocationSize; $this->_allocationSize = $allocationSize;
} }
/**
* {@inheritdoc}
*/
public function generate(EntityManager $em, $entity) public function generate(EntityManager $em, $entity)
{ {
if ($this->_maxValue === null || $this->_nextValue == $this->_maxValue) { if ($this->_maxValue === null || $this->_nextValue == $this->_maxValue) {

View File

@ -19,7 +19,6 @@
namespace Doctrine\ORM\Id; namespace Doctrine\ORM\Id;
use Serializable;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
/** /**
@ -30,13 +29,14 @@ use Doctrine\ORM\EntityManager;
*/ */
class UuidGenerator extends AbstractIdGenerator class UuidGenerator extends AbstractIdGenerator
{ {
/** /**
* Generates an ID for the given entity. * Generates an ID for the given entity.
* *
* @param Doctrine\ORM\EntityManager $em The EntityManager to user * @param EntityManager $em The EntityManager to use.
* @param object $entity * @param object $entity
*
* @return string The generated value. * @return string The generated value.
*
* @override * @override
*/ */
public function generate(EntityManager $em, $entity) public function generate(EntityManager $em, $entity)
@ -45,5 +45,4 @@ class UuidGenerator extends AbstractIdGenerator
$sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression(); $sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression();
return $conn->query($sql)->fetchColumn(0); return $conn->query($sql)->fetchColumn(0);
} }
} }

View File

@ -33,9 +33,26 @@ class CommitOrderCalculator
const IN_PROGRESS = 2; const IN_PROGRESS = 2;
const VISITED = 3; const VISITED = 3;
/**
* @var array
*/
private $_nodeStates = array(); private $_nodeStates = array();
private $_classes = array(); // The nodes to sort
/**
* The nodes to sort.
*
* @var array
*/
private $_classes = array();
/**
* @var array
*/
private $_relatedClasses = array(); private $_relatedClasses = array();
/**
* @var array
*/
private $_sorted = array(); private $_sorted = array();
/** /**
@ -85,6 +102,11 @@ class CommitOrderCalculator
return $sorted; return $sorted;
} }
/**
* @param \Doctrine\ORM\Mapping\ClassMetadata $node
*
* @return void
*/
private function _visitNode($node) private function _visitNode($node)
{ {
$this->_nodeStates[$node->name] = self::IN_PROGRESS; $this->_nodeStates[$node->name] = self::IN_PROGRESS;
@ -101,16 +123,32 @@ class CommitOrderCalculator
$this->_sorted[] = $node; $this->_sorted[] = $node;
} }
/**
* @param \Doctrine\ORM\Mapping\ClassMetadata $fromClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $toClass
*
* @return void
*/
public function addDependency($fromClass, $toClass) public function addDependency($fromClass, $toClass)
{ {
$this->_relatedClasses[$fromClass->name][] = $toClass; $this->_relatedClasses[$fromClass->name][] = $toClass;
} }
/**
* @param string $className
*
* @return bool
*/
public function hasClass($className) public function hasClass($className)
{ {
return isset($this->_classes[$className]); return isset($this->_classes[$className]);
} }
/**
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @return void
*/
public function addClass($class) public function addClass($class)
{ {
$this->_classes[$class->name] = $class; $this->_classes[$class->name] = $class;

View File

@ -20,7 +20,6 @@
namespace Doctrine\ORM\Internal\Hydration; namespace Doctrine\ORM\Internal\Hydration;
use PDO; use PDO;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Events; use Doctrine\ORM\Events;
@ -37,25 +36,53 @@ use Doctrine\ORM\Mapping\ClassMetadata;
*/ */
abstract class AbstractHydrator abstract class AbstractHydrator
{ {
/** @var \Doctrine\ORM\Query\ResultSetMapping The ResultSetMapping. */ /**
* The ResultSetMapping.
*
* @var \Doctrine\ORM\Query\ResultSetMapping
*/
protected $_rsm; protected $_rsm;
/** @var EntityManager The EntityManager instance. */ /**
* The EntityManager instance.
*
* @var EntityManager
*/
protected $_em; protected $_em;
/** @var \Doctrine\DBAL\Platforms\AbstractPlatform The dbms Platform instance */ /**
* The dbms Platform instance.
*
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
*/
protected $_platform; protected $_platform;
/** @var \Doctrine\ORM\UnitOfWork The UnitOfWork of the associated EntityManager. */ /**
* The UnitOfWork of the associated EntityManager.
*
* @var \Doctrine\ORM\UnitOfWork
*/
protected $_uow; protected $_uow;
/** @var array The cache used during row-by-row hydration. */ /**
* The cache used during row-by-row hydration.
*
* @var array
*/
protected $_cache = array(); protected $_cache = array();
/** @var \Doctrine\DBAL\Driver\Statement The statement that provides the data to hydrate. */ /**
* The statement that provides the data to hydrate.
*
* @var \Doctrine\DBAL\Driver\Statement
*/
protected $_stmt; protected $_stmt;
/** @var array The query hints. */ /**
* The query hints.
*
* @var array
*/
protected $_hints; protected $_hints;
/** /**
@ -75,6 +102,7 @@ abstract class AbstractHydrator
* *
* @param object $stmt * @param object $stmt
* @param object $resultSetMapping * @param object $resultSetMapping
* @param array $hints
* *
* @return IterableResult * @return IterableResult
*/ */
@ -97,8 +125,9 @@ abstract class AbstractHydrator
* *
* @param object $stmt * @param object $stmt
* @param object $resultSetMapping * @param object $resultSetMapping
* @param array $hints * @param array $hints
* @return mixed *
* @return array
*/ */
public function hydrateAll($stmt, $resultSetMapping, array $hints = array()) public function hydrateAll($stmt, $resultSetMapping, array $hints = array())
{ {
@ -141,13 +170,18 @@ abstract class AbstractHydrator
/** /**
* Excutes one-time preparation tasks, once each time hydration is started * Excutes one-time preparation tasks, once each time hydration is started
* through {@link hydrateAll} or {@link iterate()}. * through {@link hydrateAll} or {@link iterate()}.
*
* @return void
*/ */
protected function prepare() protected function prepare()
{} {
}
/** /**
* Excutes one-time cleanup tasks at the end of a hydration that was initiated * Excutes one-time cleanup tasks at the end of a hydration that was initiated
* through {@link hydrateAll} or {@link iterate()}. * through {@link hydrateAll} or {@link iterate()}.
*
* @return void
*/ */
protected function cleanup() protected function cleanup()
{ {
@ -162,9 +196,13 @@ abstract class AbstractHydrator
* *
* Template method. * Template method.
* *
* @param array $data The row data. * @param array $data The row data.
* @param array $cache The cache to use. * @param array $cache The cache to use.
* @param mixed $result The result to fill. * @param array $result The result to fill.
*
* @return void
*
* @throws HydrationException
*/ */
protected function hydrateRowData(array $data, array &$cache, array &$result) protected function hydrateRowData(array $data, array &$cache, array &$result)
{ {
@ -173,6 +211,8 @@ abstract class AbstractHydrator
/** /**
* Hydrates all rows from the current statement instance at once. * Hydrates all rows from the current statement instance at once.
*
* @return array
*/ */
abstract protected function hydrateAllData(); abstract protected function hydrateAllData();
@ -185,9 +225,9 @@ abstract class AbstractHydrator
* field names during this procedure as well as any necessary conversions on * field names during this procedure as well as any necessary conversions on
* the values applied. Scalar values are kept in a specfic key 'scalars'. * the values applied. Scalar values are kept in a specfic key 'scalars'.
* *
* @param array $data SQL Result Row * @param array $data SQL Result Row.
* @param array &$cache Cache for column to field result information * @param array &$cache Cache for column to field result information.
* @param array &$id Dql-Alias => ID-Hash * @param array &$id Dql-Alias => ID-Hash.
* @param array &$nonemptyComponents Does this DQL-Alias has at least one non NULL value? * @param array &$nonemptyComponents Does this DQL-Alias has at least one non NULL value?
* *
* @return array An array with all the fields (name => value) of the data row, * @return array An array with all the fields (name => value) of the data row,
@ -371,9 +411,11 @@ abstract class AbstractHydrator
/** /**
* Register entity as managed in UnitOfWork. * Register entity as managed in UnitOfWork.
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $class * @param ClassMetadata $class
* @param object $entity * @param object $entity
* @param array $data * @param array $data
*
* @return void
* *
* @todo The "$id" generation is the same of UnitOfWork#createEntity. Remove this duplication somehow * @todo The "$id" generation is the same of UnitOfWork#createEntity. Remove this duplication somehow
*/ */
@ -402,6 +444,10 @@ abstract class AbstractHydrator
/** /**
* When executed in a hydrate() loop we have to clear internal state to * When executed in a hydrate() loop we have to clear internal state to
* decrease memory consumption. * decrease memory consumption.
*
* @param mixed $eventArgs
*
* @return void
*/ */
public function onClear($eventArgs) public function onClear($eventArgs)
{ {

View File

@ -20,7 +20,6 @@
namespace Doctrine\ORM\Internal\Hydration; namespace Doctrine\ORM\Internal\Hydration;
use PDO; use PDO;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
/** /**
@ -33,12 +32,39 @@ use Doctrine\ORM\Mapping\ClassMetadata;
*/ */
class ArrayHydrator extends AbstractHydrator class ArrayHydrator extends AbstractHydrator
{ {
/**
* @var array
*/
private $_ce = array(); private $_ce = array();
/**
* @var array
*/
private $_rootAliases = array(); private $_rootAliases = array();
/**
* @var bool
*/
private $_isSimpleQuery = false; private $_isSimpleQuery = false;
/**
* @var array
*/
private $_identifierMap = array(); private $_identifierMap = array();
/**
* @var array
*/
private $_resultPointers = array(); private $_resultPointers = array();
/**
* @var array
*/
private $_idTemplate = array(); private $_idTemplate = array();
/**
* @var int
*/
private $_resultCounter = 0; private $_resultCounter = 0;
/** /**
@ -238,10 +264,12 @@ class ArrayHydrator extends AbstractHydrator
* Updates the result pointer for an Entity. The result pointers point to the * Updates the result pointer for an Entity. The result pointers point to the
* last seen instance of each Entity type. This is used for graph construction. * last seen instance of each Entity type. This is used for graph construction.
* *
* @param array $coll The element. * @param array $coll The element.
* @param boolean|integer $index Index of the element in the collection. * @param boolean|integer $index Index of the element in the collection.
* @param string $dqlAlias * @param string $dqlAlias
* @param boolean $oneToOne Whether it is a single-valued association or not. * @param boolean $oneToOne Whether it is a single-valued association or not.
*
* @return void
*/ */
private function updateResultPointer(array &$coll, $index, $dqlAlias, $oneToOne) private function updateResultPointer(array &$coll, $index, $dqlAlias, $oneToOne)
{ {

View File

@ -21,17 +21,31 @@ namespace Doctrine\ORM\Internal\Hydration;
class HydrationException extends \Doctrine\ORM\ORMException class HydrationException extends \Doctrine\ORM\ORMException
{ {
/**
* @return HydrationException
*/
public static function nonUniqueResult() public static function nonUniqueResult()
{ {
return new self("The result returned by the query was not unique."); return new self("The result returned by the query was not unique.");
} }
/**
* @param string $alias
* @param string $parentAlias
*
* @return HydrationException
*/
public static function parentObjectOfRelationNotFound($alias, $parentAlias) public static function parentObjectOfRelationNotFound($alias, $parentAlias)
{ {
return new self("The parent object of entity result with alias '$alias' was not found." return new self("The parent object of entity result with alias '$alias' was not found."
. " The parent alias is '$parentAlias'."); . " The parent alias is '$parentAlias'.");
} }
/**
* @param string $dqlAlias
*
* @return HydrationException
*/
public static function emptyDiscriminatorValue($dqlAlias) public static function emptyDiscriminatorValue($dqlAlias)
{ {
return new self("The DQL alias '" . $dqlAlias . "' contains an entity ". return new self("The DQL alias '" . $dqlAlias . "' contains an entity ".
@ -43,10 +57,12 @@ class HydrationException extends \Doctrine\ORM\ORMException
/** /**
* @since 2.3 * @since 2.3
* @param string $entityName *
* @param string $discrColumnName * @param string $entityName
* @param string $dqlAlias * @param string $discrColumnName
* @return HydrationException * @param string $dqlAlias
*
* @return HydrationException
*/ */
public static function missingDiscriminatorColumn($entityName, $discrColumnName, $dqlAlias) public static function missingDiscriminatorColumn($entityName, $discrColumnName, $dqlAlias)
{ {
@ -58,10 +74,12 @@ class HydrationException extends \Doctrine\ORM\ORMException
/** /**
* @since 2.3 * @since 2.3
* @param string $entityName *
* @param string $discrColumnName * @param string $entityName
* @param string $dqlAlias * @param string $discrColumnName
* @return HydrationException * @param string $dqlAlias
*
* @return HydrationException
*/ */
public static function missingDiscriminatorMetaMappingColumn($entityName, $discrColumnName, $dqlAlias) public static function missingDiscriminatorMetaMappingColumn($entityName, $discrColumnName, $dqlAlias)
{ {

View File

@ -44,7 +44,7 @@ class IterableResult implements \Iterator
private $_key = -1; private $_key = -1;
/** /**
* @var object * @var object|null
*/ */
private $_current = null; private $_current = null;
@ -56,6 +56,11 @@ class IterableResult implements \Iterator
$this->_hydrator = $hydrator; $this->_hydrator = $hydrator;
} }
/**
* @return void
*
* @throws HydrationException
*/
public function rewind() public function rewind()
{ {
if ($this->_rewinded == true) { if ($this->_rewinded == true) {

View File

@ -38,8 +38,11 @@ use Doctrine\ORM\Proxy\Proxy;
*/ */
class ObjectHydrator extends AbstractHydrator class ObjectHydrator extends AbstractHydrator
{ {
/* Local ClassMetadata cache to avoid going to the EntityManager all the time. /**
* Local ClassMetadata cache to avoid going to the EntityManager all the time.
* This local cache is maintained between hydration runs and not cleared. * This local cache is maintained between hydration runs and not cleared.
*
* @var array
*/ */
private $ce = array(); private $ce = array();
@ -80,7 +83,6 @@ class ObjectHydrator extends AbstractHydrator
*/ */
private $existingCollections = array(); private $existingCollections = array();
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -191,6 +193,8 @@ class ObjectHydrator extends AbstractHydrator
* @param ClassMetadata $class * @param ClassMetadata $class
* @param string $fieldName The name of the field on the entity that holds the collection. * @param string $fieldName The name of the field on the entity that holds the collection.
* @param string $parentDqlAlias Alias of the parent fetch joining this collection. * @param string $parentDqlAlias Alias of the parent fetch joining this collection.
*
* @return \Doctrine\ORM\PersistentCollection
*/ */
private function initRelatedCollection($entity, $class, $fieldName, $parentDqlAlias) private function initRelatedCollection($entity, $class, $fieldName, $parentDqlAlias)
{ {
@ -236,7 +240,10 @@ class ObjectHydrator extends AbstractHydrator
* *
* @param array $data The instance data. * @param array $data The instance data.
* @param string $dqlAlias The DQL alias of the entity's class. * @param string $dqlAlias The DQL alias of the entity's class.
*
* @return object The entity. * @return object The entity.
*
* @throws HydrationException
*/ */
private function getEntity(array $data, $dqlAlias) private function getEntity(array $data, $dqlAlias)
{ {
@ -275,6 +282,7 @@ class ObjectHydrator extends AbstractHydrator
/** /**
* @param string $className * @param string $className
* @param array $data * @param array $data
*
* @return mixed * @return mixed
*/ */
private function getEntityFromIdentityMap($className, array $data) private function getEntityFromIdentityMap($className, array $data)
@ -306,6 +314,7 @@ class ObjectHydrator extends AbstractHydrator
* local cache. * local cache.
* *
* @param string $className The name of the class. * @param string $className The name of the class.
*
* @return ClassMetadata * @return ClassMetadata
*/ */
private function getClassMetadata($className) private function getClassMetadata($className)
@ -337,6 +346,8 @@ class ObjectHydrator extends AbstractHydrator
* @param array $row The data of the row to process. * @param array $row The data of the row to process.
* @param array $cache The cache to use. * @param array $cache The cache to use.
* @param array $result The result array to fill. * @param array $result The result array to fill.
*
* @return void
*/ */
protected function hydrateRowData(array $row, array &$cache, array &$result) protected function hydrateRowData(array $row, array &$cache, array &$result)
{ {
@ -593,12 +604,15 @@ class ObjectHydrator extends AbstractHydrator
$result[$resultKey][$objIndex] = $obj; $result[$resultKey][$objIndex] = $obj;
} }
} }
} }
/** /**
* When executed in a hydrate() loop we may have to clear internal state to * When executed in a hydrate() loop we may have to clear internal state to
* decrease memory consumption. * decrease memory consumption.
*
* @param mixed $eventArgs
*
* @return void
*/ */
public function onClear($eventArgs) public function onClear($eventArgs)
{ {

View File

@ -19,11 +19,9 @@
namespace Doctrine\ORM\Internal\Hydration; namespace Doctrine\ORM\Internal\Hydration;
use \PDO; use PDO;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Query; use Doctrine\ORM\Query;
class SimpleObjectHydrator extends AbstractHydrator class SimpleObjectHydrator extends AbstractHydrator

View File

@ -19,7 +19,6 @@
namespace Doctrine\ORM\Internal\Hydration; namespace Doctrine\ORM\Internal\Hydration;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\NoResultException; use Doctrine\ORM\NoResultException;
use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\NonUniqueResultException;

View File

@ -30,9 +30,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AssociationOverride implements Annotation final class AssociationOverride implements Annotation
{ {
/** /**
* The name of the relationship property whose mapping is being overridden * The name of the relationship property whose mapping is being overridden.
* *
* @var string * @var string
*/ */
@ -45,12 +44,10 @@ final class AssociationOverride implements Annotation
*/ */
public $joinColumns; public $joinColumns;
/** /**
* The join table that maps the relationship. * The join table that maps the relationship.
* *
* @var \Doctrine\ORM\Mapping\JoinTable * @var \Doctrine\ORM\Mapping\JoinTable
*/ */
public $joinTable; public $joinTable;
} }

View File

@ -30,12 +30,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AssociationOverrides implements Annotation final class AssociationOverrides implements Annotation
{ {
/** /**
* Mapping overrides of relationship properties * Mapping overrides of relationship properties.
* *
* @var array<\Doctrine\ORM\Mapping\AssociationOverride> * @var array<\Doctrine\ORM\Mapping\AssociationOverride>
*/ */
public $value; public $value;
} }

View File

@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AttributeOverride implements Annotation final class AttributeOverride implements Annotation
{ {
/** /**
* The name of the property whose mapping is being overridden. * The name of the property whose mapping is being overridden.
* *

View File

@ -30,12 +30,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AttributeOverrides implements Annotation final class AttributeOverrides implements Annotation
{ {
/** /**
* One or more field or property mapping overrides. * One or more field or property mapping overrides.
* *
* @var array<\Doctrine\ORM\Mapping\AttributeOverride> * @var array<\Doctrine\ORM\Mapping\AttributeOverride>
*/ */
public $value; public $value;
} }

View File

@ -34,19 +34,19 @@ class AssociationBuilder
protected $mapping; protected $mapping;
/** /**
* @var array * @var array|null
*/ */
protected $joinColumns; protected $joinColumns;
/** /**
*
* @var int * @var int
*/ */
protected $type; protected $type;
/** /**
* @param ClassMetadataBuilder $builder * @param ClassMetadataBuilder $builder
* @param array $mapping * @param array $mapping
* @param int $type
*/ */
public function __construct(ClassMetadataBuilder $builder, array $mapping, $type) public function __construct(ClassMetadataBuilder $builder, array $mapping, $type)
{ {
@ -55,66 +55,103 @@ class AssociationBuilder
$this->type = $type; $this->type = $type;
} }
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function mappedBy($fieldName) public function mappedBy($fieldName)
{ {
$this->mapping['mappedBy'] = $fieldName; $this->mapping['mappedBy'] = $fieldName;
return $this; return $this;
} }
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function inversedBy($fieldName) public function inversedBy($fieldName)
{ {
$this->mapping['inversedBy'] = $fieldName; $this->mapping['inversedBy'] = $fieldName;
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeAll() public function cascadeAll()
{ {
$this->mapping['cascade'] = array("ALL"); $this->mapping['cascade'] = array("ALL");
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadePersist() public function cascadePersist()
{ {
$this->mapping['cascade'][] = "persist"; $this->mapping['cascade'][] = "persist";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeRemove() public function cascadeRemove()
{ {
$this->mapping['cascade'][] = "remove"; $this->mapping['cascade'][] = "remove";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeMerge() public function cascadeMerge()
{ {
$this->mapping['cascade'][] = "merge"; $this->mapping['cascade'][] = "merge";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeDetach() public function cascadeDetach()
{ {
$this->mapping['cascade'][] = "detach"; $this->mapping['cascade'][] = "detach";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeRefresh() public function cascadeRefresh()
{ {
$this->mapping['cascade'][] = "refresh"; $this->mapping['cascade'][] = "refresh";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function fetchExtraLazy() public function fetchExtraLazy()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function fetchEager() public function fetchEager()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_EAGER; $this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function fetchLazy() public function fetchLazy()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_LAZY; $this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
@ -122,14 +159,16 @@ class AssociationBuilder
} }
/** /**
* Add Join Columns * Add Join Columns.
* *
* @param string $columnName * @param string $columnName
* @param string $referencedColumnName * @param string $referencedColumnName
* @param bool $nullable * @param bool $nullable
* @param bool $unique * @param bool $unique
* @param string $onDelete * @param string|null $onDelete
* @param string $columnDef * @param string|null $columnDef
*
* @return AssociationBuilder
*/ */
public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null) public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{ {
@ -146,6 +185,8 @@ class AssociationBuilder
/** /**
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*
* @throws \InvalidArgumentException
*/ */
public function build() public function build()
{ {

View File

@ -55,7 +55,7 @@ class ClassMetadataBuilder
} }
/** /**
* Mark the class as mapped superclass. * Marks the class as mapped superclass.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -67,9 +67,10 @@ class ClassMetadataBuilder
} }
/** /**
* Set custom Repository class name * Sets custom Repository class name.
* *
* @param string $repositoryClassName * @param string $repositoryClassName
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function setCustomRepositoryClass($repositoryClassName) public function setCustomRepositoryClass($repositoryClassName)
@ -80,7 +81,7 @@ class ClassMetadataBuilder
} }
/** /**
* Mark class read only * Marks class read only.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -92,9 +93,10 @@ class ClassMetadataBuilder
} }
/** /**
* Set the table name * Sets the table name.
* *
* @param string $name * @param string $name
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function setTable($name) public function setTable($name)
@ -105,10 +107,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add Index * Adds Index.
* *
* @param array $columns * @param array $columns
* @param string $name * @param string $name
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addIndex(array $columns, $name) public function addIndex(array $columns, $name)
@ -123,10 +126,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add Unique Constraint * Adds Unique Constraint.
* *
* @param array $columns * @param array $columns
* @param string $name * @param string $name
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addUniqueConstraint(array $columns, $name) public function addUniqueConstraint(array $columns, $name)
@ -141,10 +145,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add named query * Adds named query.
* *
* @param string $name * @param string $name
* @param string $dqlQuery * @param string $dqlQuery
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addNamedQuery($name, $dqlQuery) public function addNamedQuery($name, $dqlQuery)
@ -158,7 +163,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set class as root of a joined table inheritance hierachy. * Sets class as root of a joined table inheritance hierachy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -170,7 +175,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set class as root of a single table inheritance hierachy. * Sets class as root of a single table inheritance hierachy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -182,10 +187,13 @@ class ClassMetadataBuilder
} }
/** /**
* Set the discriminator column details. * Sets the discriminator column details.
* *
* @param string $name * @param string $name
* @param string $type * @param string $type
* @param int $length
*
* @return ClassMetadataBuilder
*/ */
public function setDiscriminatorColumn($name, $type = 'string', $length = 255) public function setDiscriminatorColumn($name, $type = 'string', $length = 255)
{ {
@ -199,10 +207,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add a subclass to this inheritance hierachy. * Adds a subclass to this inheritance hierachy.
* *
* @param string $name * @param string $name
* @param string $class * @param string $class
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addDiscriminatorMapClass($name, $class) public function addDiscriminatorMapClass($name, $class)
@ -213,7 +222,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set deferred explicit change tracking policy. * Sets deferred explicit change tracking policy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -225,7 +234,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set notify change tracking policy. * Sets notify change tracking policy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -237,10 +246,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add lifecycle event * Adds lifecycle event.
* *
* @param string $methodName * @param string $methodName
* @param string $event * @param string $event
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addLifecycleEvent($methodName, $event) public function addLifecycleEvent($methodName, $event)
@ -251,11 +261,13 @@ class ClassMetadataBuilder
} }
/** /**
* Add Field * Adds Field.
* *
* @param string $name * @param string $name
* @param string $type * @param string $type
* @param array $mapping * @param array $mapping
*
* @return ClassMetadataBuilder
*/ */
public function addField($name, $type, array $mapping = array()) public function addField($name, $type, array $mapping = array())
{ {
@ -268,10 +280,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create a field builder. * Creates a field builder.
* *
* @param string $name * @param string $name
* @param string $type * @param string $type
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function createField($name, $type) public function createField($name, $type)
@ -286,11 +299,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add a simple many to one association, optionally with the inversed by field. * Adds a simple many to one association, optionally with the inversed by field.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string|null $inversedBy * @param string|null $inversedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addManyToOne($name, $targetEntity, $inversedBy = null) public function addManyToOne($name, $targetEntity, $inversedBy = null)
@ -305,12 +319,13 @@ class ClassMetadataBuilder
} }
/** /**
* Create a ManyToOne Assocation Builder. * Creates a ManyToOne Assocation Builder.
* *
* Note: This method does not add the association, you have to call build() on the AssociationBuilder. * Note: This method does not add the association, you have to call build() on the AssociationBuilder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return AssociationBuilder * @return AssociationBuilder
*/ */
public function createManyToOne($name, $targetEntity) public function createManyToOne($name, $targetEntity)
@ -326,10 +341,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create OneToOne Assocation Builder * Creates a OneToOne Association Builder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return AssociationBuilder * @return AssociationBuilder
*/ */
public function createOneToOne($name, $targetEntity) public function createOneToOne($name, $targetEntity)
@ -345,11 +361,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add simple inverse one-to-one assocation. * Adds simple inverse one-to-one assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string $mappedBy * @param string $mappedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addInverseOneToOne($name, $targetEntity, $mappedBy) public function addInverseOneToOne($name, $targetEntity, $mappedBy)
@ -361,11 +378,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add simple owning one-to-one assocation. * Adds simple owning one-to-one assocation.
*
* @param string $name
* @param string $targetEntity
* @param string|null $inversedBy
* *
* @param string $name
* @param string $targetEntity
* @param string $inversedBy
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addOwningOneToOne($name, $targetEntity, $inversedBy = null) public function addOwningOneToOne($name, $targetEntity, $inversedBy = null)
@ -380,10 +398,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create ManyToMany Assocation Builder * Creates a ManyToMany Assocation Builder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return ManyToManyAssociationBuilder * @return ManyToManyAssociationBuilder
*/ */
public function createManyToMany($name, $targetEntity) public function createManyToMany($name, $targetEntity)
@ -399,11 +418,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add a simple owning many to many assocation. * Adds a simple owning many to many assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string|null $inversedBy * @param string|null $inversedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addOwningManyToMany($name, $targetEntity, $inversedBy = null) public function addOwningManyToMany($name, $targetEntity, $inversedBy = null)
@ -418,11 +438,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add a simple inverse many to many assocation. * Adds a simple inverse many to many assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string $mappedBy * @param string $mappedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addInverseManyToMany($name, $targetEntity, $mappedBy) public function addInverseManyToMany($name, $targetEntity, $mappedBy)
@ -434,10 +455,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create a one to many assocation builder * Creates a one to many assocation builder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return OneToManyAssociationBuilder * @return OneToManyAssociationBuilder
*/ */
public function createOneToMany($name, $targetEntity) public function createOneToMany($name, $targetEntity)
@ -453,11 +475,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add simple OneToMany assocation. * Adds simple OneToMany assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string $mappedBy * @param string $mappedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addOneToMany($name, $targetEntity, $mappedBy) public function addOneToMany($name, $targetEntity, $mappedBy)

View File

@ -33,10 +33,12 @@ class FieldBuilder
* @var ClassMetadataBuilder * @var ClassMetadataBuilder
*/ */
private $builder; private $builder;
/** /**
* @var array * @var array
*/ */
private $mapping; private $mapping;
/** /**
* @var bool * @var bool
*/ */
@ -53,9 +55,8 @@ class FieldBuilder
private $sequenceDef; private $sequenceDef;
/** /**
*
* @param ClassMetadataBuilder $builder * @param ClassMetadataBuilder $builder
* @param array $mapping * @param array $mapping
*/ */
public function __construct(ClassMetadataBuilder $builder, array $mapping) public function __construct(ClassMetadataBuilder $builder, array $mapping)
{ {
@ -64,9 +65,10 @@ class FieldBuilder
} }
/** /**
* Set length. * Sets length.
* *
* @param int $length * @param int $length
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function length($length) public function length($length)
@ -76,9 +78,10 @@ class FieldBuilder
} }
/** /**
* Set nullable * Sets nullable.
*
* @param bool $flag
* *
* @param bool
* @return FieldBuilder * @return FieldBuilder
*/ */
public function nullable($flag = true) public function nullable($flag = true)
@ -88,9 +91,10 @@ class FieldBuilder
} }
/** /**
* Set Unique * Sets Unique.
*
* @param bool $flag
* *
* @param bool
* @return FieldBuilder * @return FieldBuilder
*/ */
public function unique($flag = true) public function unique($flag = true)
@ -100,9 +104,10 @@ class FieldBuilder
} }
/** /**
* Set column name * Sets column name.
* *
* @param string $name * @param string $name
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function columnName($name) public function columnName($name)
@ -112,9 +117,10 @@ class FieldBuilder
} }
/** /**
* Set Precision * Sets Precision.
*
* @param int $p
* *
* @param int $p
* @return FieldBuilder * @return FieldBuilder
*/ */
public function precision($p) public function precision($p)
@ -124,9 +130,10 @@ class FieldBuilder
} }
/** /**
* Set scale. * Sets scale.
* *
* @param int $s * @param int $s
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function scale($s) public function scale($s)
@ -136,7 +143,7 @@ class FieldBuilder
} }
/** /**
* Set field as primary key. * Sets field as primary key.
* *
* @return FieldBuilder * @return FieldBuilder
*/ */
@ -147,7 +154,8 @@ class FieldBuilder
} }
/** /**
* @param int $strategy * @param string $strategy
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function generatedValue($strategy = 'AUTO') public function generatedValue($strategy = 'AUTO')
@ -157,7 +165,7 @@ class FieldBuilder
} }
/** /**
* Set field versioned * Sets field versioned.
* *
* @return FieldBuilder * @return FieldBuilder
*/ */
@ -168,11 +176,12 @@ class FieldBuilder
} }
/** /**
* Set Sequence Generator * Sets Sequence Generator.
* *
* @param string $sequenceName * @param string $sequenceName
* @param int $allocationSize * @param int $allocationSize
* @param int $initialValue * @param int $initialValue
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1) public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1)
@ -186,9 +195,10 @@ class FieldBuilder
} }
/** /**
* Set column definition. * Sets column definition.
* *
* @param string $def * @param string $def
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function columnDefinition($def) public function columnDefinition($def)
@ -198,7 +208,7 @@ class FieldBuilder
} }
/** /**
* Finalize this field and attach it to the ClassMetadata. * Finalizes this field and attach it to the ClassMetadata.
* *
* Without this call a FieldBuilder has no effect on the ClassMetadata. * Without this call a FieldBuilder has no effect on the ClassMetadata.
* *

View File

@ -29,10 +29,21 @@ namespace Doctrine\ORM\Mapping\Builder;
*/ */
class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
{ {
/**
* @var string|null
*/
private $joinTableName; private $joinTableName;
/**
* @var array
*/
private $inverseJoinColumns = array(); private $inverseJoinColumns = array();
/**
* @param string $name
*
* @return ManyToManyAssociationBuilder
*/
public function setJoinTable($name) public function setJoinTable($name)
{ {
$this->joinTableName = $name; $this->joinTableName = $name;
@ -40,14 +51,16 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
} }
/** /**
* Add Inverse Join Columns * Adds Inverse Join Columns.
* *
* @param string $columnName * @param string $columnName
* @param string $referencedColumnName * @param string $referencedColumnName
* @param bool $nullable * @param bool $nullable
* @param bool $unique * @param bool $unique
* @param string $onDelete * @param string|null $onDelete
* @param string $columnDef * @param string|null $columnDef
*
* @return ManyToManyAssociationBuilder
*/ */
public function addInverseJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null) public function addInverseJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{ {

View File

@ -31,6 +31,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
{ {
/** /**
* @param array $fieldNames * @param array $fieldNames
*
* @return OneToManyAssociationBuilder * @return OneToManyAssociationBuilder
*/ */
public function setOrderBy(array $fieldNames) public function setOrderBy(array $fieldNames)
@ -39,6 +40,11 @@ class OneToManyAssociationBuilder extends AssociationBuilder
return $this; return $this;
} }
/**
* @param string $fieldName
*
* @return OneToManyAssociationBuilder
*/
public function setIndexBy($fieldName) public function setIndexBy($fieldName)
{ {
$this->mapping['indexBy'] = $fieldName; $this->mapping['indexBy'] = $fieldName;

View File

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
final class ChangeTrackingPolicy implements Annotation final class ChangeTrackingPolicy implements Annotation
{ {
/** /**
* @var string The change tracking policy. * The change tracking policy.
*
* @var string
* *
* @Enum({"DEFERRED_IMPLICIT", "DEFERRED_EXPLICIT", "NOTIFY"}) * @Enum({"DEFERRED_IMPLICIT", "DEFERRED_EXPLICIT", "NOTIFY"})
*/ */

View File

@ -173,8 +173,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
/** /**
* Validate runtime metadata is correctly defined. * Validate runtime metadata is correctly defined.
* *
* @param ClassMetadata $class * @param ClassMetadata $class
* @param $parent * @param ClassMetadataInterface|null $parent
*
* @return void
*
* @throws MappingException * @throws MappingException
*/ */
protected function validateRuntimeMetadata($class, $parent) protected function validateRuntimeMetadata($class, $parent)
@ -226,6 +229,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* each class as key. * each class as key.
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $class * @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @throws MappingException * @throws MappingException
*/ */
private function addDefaultDiscriminatorMap(ClassMetadata $class) private function addDefaultDiscriminatorMap(ClassMetadata $class)
@ -255,9 +259,10 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
} }
/** /**
* Get the lower-case short name of a class. * Gets the lower-case short name of a class.
* *
* @param string $className * @param string $className
*
* @return string * @return string
*/ */
private function getShortName($className) private function getShortName($className)
@ -275,6 +280,8 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -297,6 +304,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*
* @throws MappingException * @throws MappingException
*/ */
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
@ -324,8 +334,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named queries to the subclass mapping. * Adds inherited named queries to the subclass mapping.
* *
* @since 2.2 * @since 2.2
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -343,8 +356,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named native queries to the subclass mapping. * Adds inherited named native queries to the subclass mapping.
* *
* @since 2.3 * @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedNamedNativeQueries(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedNamedNativeQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -365,8 +381,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited sql result set mappings to the subclass mapping. * Adds inherited sql result set mappings to the subclass mapping.
* *
* @since 2.3 * @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -396,6 +415,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* most appropriate for the targeted database platform. * most appropriate for the targeted database platform.
* *
* @param ClassMetadataInfo $class * @param ClassMetadataInfo $class
*
* @return void
*
* @throws ORMException * @throws ORMException
*/ */
private function completeIdGeneratorMapping(ClassMetadataInfo $class) private function completeIdGeneratorMapping(ClassMetadataInfo $class)

File diff suppressed because it is too large Load Diff

View File

@ -25,22 +25,52 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Column implements Annotation final class Column implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var mixed */
/**
* @var mixed
*/
public $type = 'string'; public $type = 'string';
/** @var integer */
/**
* @var integer
*/
public $length; public $length;
/** @var integer */
public $precision = 0; // The precision for a decimal (exact numeric) column (Applies only for decimal column) /**
/** @var integer */ * The precision for a decimal (exact numeric) column (Applies only for decimal column).
public $scale = 0; // The scale for a decimal (exact numeric) column (Applies only for decimal column) *
/** @var boolean */ * @var integer
*/
public $precision = 0;
/**
* The scale for a decimal (exact numeric) column (Applies only for decimal column).
*
* @var integer
*/
public $scale = 0;
/**
* @var boolean
*/
public $unique = false; public $unique = false;
/** @var boolean */
/**
* @var boolean
*/
public $nullable = false; public $nullable = false;
/** @var array */
/**
* @var array
*/
public $options = array(); public $options = array();
/** @var string */
/**
* @var string
*/
public $columnDefinition; public $columnDefinition;
} }

View File

@ -31,12 +31,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class ColumnResult implements Annotation final class ColumnResult implements Annotation
{ {
/** /**
* The name of a column in the SELECT clause of a SQL query * The name of a column in the SELECT clause of a SQL query.
* *
* @var string * @var string
*/ */
public $name; public $name;
} }

View File

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class CustomIdGenerator implements Annotation final class CustomIdGenerator implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $class; public $class;
} }

View File

@ -136,5 +136,4 @@ class DefaultQuoteStrategy implements QuoteStrategy
return $platform->getSQLResultCasing($columnName); return $platform->getSQLResultCasing($columnName);
} }
} }

View File

@ -25,14 +25,30 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class DiscriminatorColumn implements Annotation final class DiscriminatorColumn implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $type; public $type;
/** @var integer */
/**
* @var integer
*/
public $length; public $length;
/** @var mixed */
public $fieldName; // field name used in non-object hydration (array/scalar) /**
/** @var string */ * Field name used in non-object hydration (array/scalar).
*
* @var mixed
*/
public $fieldName;
/**
* @var string
*/
public $columnDefinition; public $columnDefinition;
} }

View File

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class DiscriminatorMap implements Annotation final class DiscriminatorMap implements Annotation
{ {
/** @var array<string> */ /**
* @var array<string>
*/
public $value; public $value;
} }

View File

@ -19,12 +19,12 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Annotations\AnnotationReader, use Doctrine\Common\Annotations\AnnotationReader;
Doctrine\ORM\Mapping\MappingException, use Doctrine\ORM\Mapping\MappingException;
Doctrine\ORM\Mapping\JoinColumn, use Doctrine\ORM\Mapping\JoinColumn;
Doctrine\ORM\Mapping\Column, use Doctrine\ORM\Mapping\Column;
Doctrine\Common\Persistence\Mapping\ClassMetadata, use Doctrine\Common\Persistence\Mapping\ClassMetadata;
Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver as AbstractAnnotationDriver; use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver as AbstractAnnotationDriver;
/** /**
* The AnnotationDriver reads the mapping metadata from docblock annotations. * The AnnotationDriver reads the mapping metadata from docblock annotations.
@ -471,10 +471,12 @@ class AnnotationDriver extends AbstractAnnotationDriver
/** /**
* Attempts to resolve the fetch mode. * Attempts to resolve the fetch mode.
* *
* @param string $className The class name * @param string $className The class name.
* @param string $fetchMode The fetch mode * @param string $fetchMode The fetch mode.
* @return integer The fetch mode as defined in ClassMetadata *
* @throws MappingException If the fetch mode is not valid * @return integer The fetch mode as defined in ClassMetadata.
*
* @throws MappingException If the fetch mode is not valid.
*/ */
private function getFetchMode($className, $fetchMode) private function getFetchMode($className, $fetchMode)
{ {
@ -486,10 +488,11 @@ class AnnotationDriver extends AbstractAnnotationDriver
} }
/** /**
* Parse the given JoinColumn as array * Parses the given JoinColumn as array.
* *
* @param JoinColumn $joinColumn * @param JoinColumn $joinColumn
* @return array *
* @return array
*/ */
private function joinColumnToArray(JoinColumn $joinColumn) private function joinColumnToArray(JoinColumn $joinColumn)
{ {
@ -506,9 +509,10 @@ class AnnotationDriver extends AbstractAnnotationDriver
/** /**
* Parse the given Column as array * Parse the given Column as array
* *
* @param string $fieldName * @param string $fieldName
* @param Column $column * @param Column $column
* @return array *
* @return array
*/ */
private function columnToArray($fieldName, Column $column) private function columnToArray($fieldName, Column $column)
{ {
@ -538,10 +542,11 @@ class AnnotationDriver extends AbstractAnnotationDriver
} }
/** /**
* Factory method for the Annotation Driver * Factory method for the Annotation Driver.
*
* @param array|string $paths
* @param AnnotationReader|null $reader
* *
* @param array|string $paths
* @param AnnotationReader $reader
* @return AnnotationDriver * @return AnnotationDriver
*/ */
static public function create($paths = array(), AnnotationReader $reader = null) static public function create($paths = array(), AnnotationReader $reader = null)

View File

@ -19,18 +19,17 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\DBAL\Schema\AbstractSchemaManager, use Doctrine\DBAL\Schema\AbstractSchemaManager;
Doctrine\DBAL\Schema\SchemaException, use Doctrine\DBAL\Schema\SchemaException;
Doctrine\Common\Persistence\Mapping\Driver\MappingDriver, use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
Doctrine\Common\Persistence\Mapping\ClassMetadata, use Doctrine\Common\Persistence\Mapping\ClassMetadata;
Doctrine\ORM\Mapping\ClassMetadataInfo, use Doctrine\ORM\Mapping\ClassMetadataInfo;
Doctrine\Common\Util\Inflector, use Doctrine\Common\Util\Inflector;
Doctrine\ORM\Mapping\MappingException; use Doctrine\ORM\Mapping\MappingException;
/** /**
* The DatabaseDriver reverse engineers the mapping metadata from a database. * The DatabaseDriver reverse engineers the mapping metadata from a database.
* *
*
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
@ -45,10 +44,13 @@ class DatabaseDriver implements MappingDriver
private $_sm; private $_sm;
/** /**
* @var array * @var array|null
*/ */
private $tables = null; private $tables = null;
/**
* @var array
*/
private $classToTableNames = array(); private $classToTableNames = array();
/** /**
@ -69,12 +71,11 @@ class DatabaseDriver implements MappingDriver
/** /**
* The namespace for the generated entities. * The namespace for the generated entities.
* *
* @var string * @var string|null
*/ */
private $namespace; private $namespace;
/** /**
*
* @param AbstractSchemaManager $schemaManager * @param AbstractSchemaManager $schemaManager
*/ */
public function __construct(AbstractSchemaManager $schemaManager) public function __construct(AbstractSchemaManager $schemaManager)
@ -83,10 +84,11 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Set tables manually instead of relying on the reverse engeneering capabilities of SchemaManager. * Sets tables manually instead of relying on the reverse engeneering capabilities of SchemaManager.
* *
* @param array $entityTables * @param array $entityTables
* @param array $manyToManyTables * @param array $manyToManyTables
*
* @return void * @return void
*/ */
public function setTables($entityTables, $manyToManyTables) public function setTables($entityTables, $manyToManyTables)
@ -102,6 +104,11 @@ class DatabaseDriver implements MappingDriver
} }
} }
/**
* @return void
*
* @throws \Doctrine\ORM\Mapping\MappingException
*/
private function reverseEngineerMappingFromDatabase() private function reverseEngineerMappingFromDatabase()
{ {
if ($this->tables !== null) { if ($this->tables !== null) {
@ -340,10 +347,11 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Set class name for a table. * Sets class name for a table.
* *
* @param string $tableName * @param string $tableName
* @param string $className * @param string $className
*
* @return void * @return void
*/ */
public function setClassNameForTable($tableName, $className) public function setClassNameForTable($tableName, $className)
@ -352,11 +360,12 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Set field name for a column on a specific table. * Sets field name for a column on a specific table.
* *
* @param string $tableName * @param string $tableName
* @param string $columnName * @param string $columnName
* @param string $fieldName * @param string $fieldName
*
* @return void * @return void
*/ */
public function setFieldNameForColumn($tableName, $columnName, $fieldName) public function setFieldNameForColumn($tableName, $columnName, $fieldName)
@ -365,9 +374,10 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Return the mapped class name for a table if it exists. Otherwise return "classified" version. * Returns the mapped class name for a table if it exists. Otherwise return "classified" version.
* *
* @param string $tableName * @param string $tableName
*
* @return string * @return string
*/ */
private function getClassNameForTable($tableName) private function getClassNameForTable($tableName)
@ -382,9 +392,10 @@ class DatabaseDriver implements MappingDriver
/** /**
* Return the mapped field name for a column, if it exists. Otherwise return camelized version. * Return the mapped field name for a column, if it exists. Otherwise return camelized version.
* *
* @param string $tableName * @param string $tableName
* @param string $columnName * @param string $columnName
* @param boolean $fk Whether the column is a foreignkey or not. * @param boolean $fk Whether the column is a foreignkey or not.
*
* @return string * @return string
*/ */
private function getFieldNameForColumn($tableName, $columnName, $fk = false) private function getFieldNameForColumn($tableName, $columnName, $fk = false)
@ -406,6 +417,7 @@ class DatabaseDriver implements MappingDriver
* Set the namespace for the generated entities. * Set the namespace for the generated entities.
* *
* @param string $namespace * @param string $namespace
*
* @return void * @return void
*/ */
public function setNamespace($namespace) public function setNamespace($namespace)

View File

@ -561,7 +561,8 @@ class XmlDriver extends FileDriver
/** /**
* Parses (nested) option elements. * Parses (nested) option elements.
* *
* @param SimpleXMLElement $options the XML element. * @param SimpleXMLElement $options The XML element.
*
* @return array The options array. * @return array The options array.
*/ */
private function _parseOptions(SimpleXMLElement $options) private function _parseOptions(SimpleXMLElement $options)
@ -592,7 +593,8 @@ class XmlDriver extends FileDriver
* Constructs a joinColumn mapping array based on the information * Constructs a joinColumn mapping array based on the information
* found in the given SimpleXMLElement. * found in the given SimpleXMLElement.
* *
* @param SimpleXMLElement $joinColumnElement the XML element. * @param SimpleXMLElement $joinColumnElement The XML element.
*
* @return array The mapping array. * @return array The mapping array.
*/ */
private function joinColumnToArray(SimpleXMLElement $joinColumnElement) private function joinColumnToArray(SimpleXMLElement $joinColumnElement)
@ -622,10 +624,11 @@ class XmlDriver extends FileDriver
} }
/** /**
* Parse the given field as array * Parses the given field as array.
* *
* @param SimpleXMLElement $fieldMapping * @param SimpleXMLElement $fieldMapping
* @return array *
* @return array
*/ */
private function columnToArray(SimpleXMLElement $fieldMapping) private function columnToArray(SimpleXMLElement $fieldMapping)
{ {
@ -679,7 +682,8 @@ class XmlDriver extends FileDriver
/** /**
* Gathers a list of cascade options found in the given cascade element. * Gathers a list of cascade options found in the given cascade element.
* *
* @param SimpleXMLElement $cascadeElement the cascade element. * @param SimpleXMLElement $cascadeElement The cascade element.
*
* @return array The list of cascade options. * @return array The list of cascade options.
*/ */
private function _getCascadeMappings($cascadeElement) private function _getCascadeMappings($cascadeElement)
@ -720,6 +724,11 @@ class XmlDriver extends FileDriver
return $result; return $result;
} }
/**
* @param mixed $element
*
* @return bool
*/
protected function evaluateBoolean($element) protected function evaluateBoolean($element)
{ {
$flag = (string)$element; $flag = (string)$element;
@ -727,4 +736,3 @@ class XmlDriver extends FileDriver
return ($flag === true || $flag == "true" || $flag == "1"); return ($flag === true || $flag == "true" || $flag == "1");
} }
} }

View File

@ -19,10 +19,10 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata, use Doctrine\Common\Persistence\Mapping\ClassMetadata;
Doctrine\Common\Persistence\Mapping\Driver\FileDriver, use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
Doctrine\ORM\Mapping\MappingException, use Doctrine\ORM\Mapping\MappingException;
Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
/** /**
* The YamlDriver reads the mapping metadata from yaml schema files. * The YamlDriver reads the mapping metadata from yaml schema files.
@ -578,7 +578,8 @@ class YamlDriver extends FileDriver
* Constructs a joinColumn mapping array based on the information * Constructs a joinColumn mapping array based on the information
* found in the given join column element. * found in the given join column element.
* *
* @param array $joinColumnElement The array join column element * @param array $joinColumnElement The array join column element.
*
* @return array The mapping array. * @return array The mapping array.
*/ */
private function joinColumnToArray($joinColumnElement) private function joinColumnToArray($joinColumnElement)
@ -616,10 +617,11 @@ class YamlDriver extends FileDriver
} }
/** /**
* Parse the given column as array * Parses the given column as array.
*
* @param string $fieldName
* @param array $column
* *
* @param string $fieldName
* @param array $column
* @return array * @return array
*/ */
private function columnToArray($fieldName, $column) private function columnToArray($fieldName, $column)

View File

@ -26,6 +26,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class ElementCollection implements Annotation final class ElementCollection implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $tableName; public $tableName;
} }

View File

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Entity implements Annotation final class Entity implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $repositoryClass; public $repositoryClass;
/** @var boolean */
/**
* @var boolean
*/
public $readOnly = false; public $readOnly = false;
} }

View File

@ -33,9 +33,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class EntityResult implements Annotation final class EntityResult implements Annotation
{ {
/** /**
* The class of the result * The class of the result.
* *
* @var string * @var string
*/ */
@ -54,5 +53,4 @@ final class EntityResult implements Annotation
* @var string * @var string
*/ */
public $discriminatorColumn; public $discriminatorColumn;
} }

View File

@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class FieldResult implements Annotation final class FieldResult implements Annotation
{ {
/** /**
* Name of the column in the SELECT clause. * Name of the column in the SELECT clause.
* *
@ -39,10 +38,9 @@ final class FieldResult implements Annotation
public $name; public $name;
/** /**
* Name of the persistent field or property of the class. * Name of the persistent field or property of the class.
* *
* @var string * @var string
*/ */
public $column; public $column;
} }

View File

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
final class GeneratedValue implements Annotation final class GeneratedValue implements Annotation
{ {
/** /**
* @var string The type of Id generator. * The type of Id generator.
*
* @var string
* *
* @Enum({"AUTO", "SEQUENCE", "TABLE", "IDENTITY", "NONE", "UUID", "CUSTOM"}) * @Enum({"AUTO", "SEQUENCE", "TABLE", "IDENTITY", "NONE", "UUID", "CUSTOM"})
*/ */

View File

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Index implements Annotation final class Index implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var array<string> */
/**
* @var array<string>
*/
public $columns; public $columns;
} }

View File

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
final class InheritanceType implements Annotation final class InheritanceType implements Annotation
{ {
/** /**
* @var string The inheritance type used by the class and it's subclasses. * The inheritance type used by the class and its subclasses.
*
* @var string
* *
* @Enum({"NONE", "JOINED", "SINGLE_TABLE", "TABLE_PER_CLASS"}) * @Enum({"NONE", "JOINED", "SINGLE_TABLE", "TABLE_PER_CLASS"})
*/ */

View File

@ -25,18 +25,40 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class JoinColumn implements Annotation final class JoinColumn implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $referencedColumnName = 'id'; public $referencedColumnName = 'id';
/** @var boolean */
/**
* @var boolean
*/
public $unique = false; public $unique = false;
/** @var boolean */
/**
* @var boolean
*/
public $nullable = true; public $nullable = true;
/** @var mixed */
/**
* @var mixed
*/
public $onDelete; public $onDelete;
/** @var string */
/**
* @var string
*/
public $columnDefinition; public $columnDefinition;
/** @var string */
public $fieldName; // field name used in non-object hydration (array/scalar) /**
* Field name used in non-object hydration (array/scalar).
*
* @var string
*/
public $fieldName;
} }

View File

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class JoinColumns implements Annotation final class JoinColumns implements Annotation
{ {
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */ /**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $value; public $value;
} }

View File

@ -25,12 +25,23 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class JoinTable implements Annotation final class JoinTable implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $schema; public $schema;
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $joinColumns = array(); public $joinColumns = array();
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $inverseJoinColumns = array(); public $inverseJoinColumns = array();
} }

View File

@ -46,7 +46,9 @@ final class ManyToMany implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View File

@ -36,7 +36,9 @@ final class ManyToOne implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View File

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class MappedSuperclass implements Annotation final class MappedSuperclass implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $repositoryClass; public $repositoryClass;
} }

View File

@ -26,12 +26,20 @@ namespace Doctrine\ORM\Mapping;
*/ */
class MappingException extends \Doctrine\ORM\ORMException class MappingException extends \Doctrine\ORM\ORMException
{ {
/**
* @return MappingException
*/
public static function pathRequired() public static function pathRequired()
{ {
return new self("Specifying the paths to your entities is required ". return new self("Specifying the paths to your entities is required ".
"in the AnnotationDriver to retrieve all class names."); "in the AnnotationDriver to retrieve all class names.");
} }
/**
* @param string $entityName
*
* @return MappingException
*/
public static function identifierRequired($entityName) public static function identifierRequired($entityName)
{ {
if (false !== ($parent = get_parent_class($entityName))) { if (false !== ($parent = get_parent_class($entityName))) {
@ -48,41 +56,73 @@ class MappingException extends \Doctrine\ORM\ORMException
} }
/**
* @param string $entityName
* @param string $type
*
* @return MappingException
*/
public static function invalidInheritanceType($entityName, $type) public static function invalidInheritanceType($entityName, $type)
{ {
return new self("The inheritance type '$type' specified for '$entityName' does not exist."); return new self("The inheritance type '$type' specified for '$entityName' does not exist.");
} }
/**
* @return MappingException
*/
public static function generatorNotAllowedWithCompositeId() public static function generatorNotAllowedWithCompositeId()
{ {
return new self("Id generators can't be used with a composite id."); return new self("Id generators can't be used with a composite id.");
} }
/**
* @param string $entity
*
* @return MappingException
*/
public static function missingFieldName($entity) public static function missingFieldName($entity)
{ {
return new self("The field or association mapping misses the 'fieldName' attribute in entity '$entity'."); return new self("The field or association mapping misses the 'fieldName' attribute in entity '$entity'.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function missingTargetEntity($fieldName) public static function missingTargetEntity($fieldName)
{ {
return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute."); return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function missingSourceEntity($fieldName) public static function missingSourceEntity($fieldName)
{ {
return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute."); return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute.");
} }
/**
* @param string $entityName
* @param string $fileName
*
* @return MappingException
*/
public static function mappingFileNotFound($entityName, $fileName) public static function mappingFileNotFound($entityName, $fileName)
{ {
return new self("No mapping file found named '$fileName' for class '$entityName'."); return new self("No mapping file found named '$fileName' for class '$entityName'.");
} }
/** /**
* Exception for invalid property name override. * Exception for invalid property name override.
* *
* @param string $className The entity's name * @param string $className The entity's name.
* @param string $fieldName * @param string $fieldName
*
* @return MappingException
*/ */
public static function invalidOverrideFieldName($className, $fieldName) public static function invalidOverrideFieldName($className, $fieldName)
{ {
@ -92,64 +132,128 @@ class MappingException extends \Doctrine\ORM\ORMException
/** /**
* Exception for invalid property type override. * Exception for invalid property type override.
* *
* @param string $className The entity's name * @param string $className The entity's name.
* @param string $fieldName * @param string $fieldName
*
* @return MappingException
*/ */
public static function invalidOverrideFieldType($className, $fieldName) public static function invalidOverrideFieldType($className, $fieldName)
{ {
return new self("The column type of attribute '$fieldName' on class '$className' could not be changed."); return new self("The column type of attribute '$fieldName' on class '$className' could not be changed.");
} }
/**
* @param string $className
* @param string $fieldName
*
* @return MappingException
*/
public static function mappingNotFound($className, $fieldName) public static function mappingNotFound($className, $fieldName)
{ {
return new self("No mapping found for field '$fieldName' on class '$className'."); return new self("No mapping found for field '$fieldName' on class '$className'.");
} }
/**
* @param string $className
* @param string $queryName
*
* @return MappingException
*/
public static function queryNotFound($className, $queryName) public static function queryNotFound($className, $queryName)
{ {
return new self("No query found named '$queryName' on class '$className'."); return new self("No query found named '$queryName' on class '$className'.");
} }
/**
* @param string $className
* @param string $resultName
*
* @return MappingException
*/
public static function resultMappingNotFound($className, $resultName) public static function resultMappingNotFound($className, $resultName)
{ {
return new self("No result set mapping found named '$resultName' on class '$className'."); return new self("No result set mapping found named '$resultName' on class '$className'.");
} }
/**
* @param string $entity
* @param string $queryName
*
* @return MappingException
*/
public static function emptyQueryMapping($entity, $queryName) public static function emptyQueryMapping($entity, $queryName)
{ {
return new self('Query named "'.$queryName.'" in "'.$entity.'" could not be empty.'); return new self('Query named "'.$queryName.'" in "'.$entity.'" could not be empty.');
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForQueryMapping($className) public static function nameIsMandatoryForQueryMapping($className)
{ {
return new self("Query name on entity class '$className' is not defined."); return new self("Query name on entity class '$className' is not defined.");
} }
/**
* @param string $entity
* @param string $queryName
*
* @return MappingException
*/
public static function missingQueryMapping($entity, $queryName) public static function missingQueryMapping($entity, $queryName)
{ {
return new self('Query named "'.$queryName.'" in "'.$entity.' requires a result class or result set mapping.'); return new self('Query named "'.$queryName.'" in "'.$entity.' requires a result class or result set mapping.');
} }
/**
* @param string $entity
* @param string $resultName
*
* @return MappingException
*/
public static function missingResultSetMappingEntity($entity, $resultName) public static function missingResultSetMappingEntity($entity, $resultName)
{ {
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a entity class name.'); return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a entity class name.');
} }
/**
* @param string $entity
* @param string $resultName
*
* @return MappingException
*/
public static function missingResultSetMappingFieldName($entity, $resultName) public static function missingResultSetMappingFieldName($entity, $resultName)
{ {
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.'); return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.');
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForSqlResultSetMapping($className) public static function nameIsMandatoryForSqlResultSetMapping($className)
{ {
return new self("Result set mapping name on entity class '$className' is not defined."); return new self("Result set mapping name on entity class '$className' is not defined.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function oneToManyRequiresMappedBy($fieldName) public static function oneToManyRequiresMappedBy($fieldName)
{ {
return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute."); return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function joinTableRequired($fieldName) public static function joinTableRequired($fieldName)
{ {
return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute."); return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute.");
@ -158,10 +262,11 @@ class MappingException extends \Doctrine\ORM\ORMException
/** /**
* Called if a required option was not found but is required * Called if a required option was not found but is required
* *
* @param string $field which field cannot be processed? * @param string $field Which field cannot be processed?
* @param string $expectedOption which option is required * @param string $expectedOption Which option is required
* @param string $hint Can optionally be used to supply a tip for common mistakes, * @param string $hint Can optionally be used to supply a tip for common mistakes,
* e.g. "Did you think of the plural s?" * e.g. "Did you think of the plural s?"
*
* @return MappingException * @return MappingException
*/ */
static function missingRequiredOption($field, $expectedOption, $hint = '') static function missingRequiredOption($field, $expectedOption, $hint = '')
@ -179,6 +284,8 @@ class MappingException extends \Doctrine\ORM\ORMException
* Generic exception for invalid mappings. * Generic exception for invalid mappings.
* *
* @param string $fieldName * @param string $fieldName
*
* @return MappingException
*/ */
public static function invalidMapping($fieldName) public static function invalidMapping($fieldName)
{ {
@ -190,20 +297,33 @@ class MappingException extends \Doctrine\ORM\ORMException
* because there might be long classnames that will be shortened * because there might be long classnames that will be shortened
* within the stacktrace * within the stacktrace
* *
* @param string $entity The entity's name * @param string $entity The entity's name
* @param \ReflectionException $previousException * @param \ReflectionException $previousException
*
* @return MappingException
*/ */
public static function reflectionFailure($entity, \ReflectionException $previousException) public static function reflectionFailure($entity, \ReflectionException $previousException)
{ {
return new self('An error occurred in ' . $entity, 0, $previousException); return new self('An error occurred in ' . $entity, 0, $previousException);
} }
/**
* @param string $className
* @param string $joinColumn
*
* @return MappingException
*/
public static function joinColumnMustPointToMappedField($className, $joinColumn) public static function joinColumnMustPointToMappedField($className, $joinColumn)
{ {
return new self('The column ' . $joinColumn . ' must be mapped to a field in class ' return new self('The column ' . $joinColumn . ' must be mapped to a field in class '
. $className . ' since it is referenced by a join column of another class.'); . $className . ' since it is referenced by a join column of another class.');
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function classIsNotAValidEntityOrMappedSuperClass($className) public static function classIsNotAValidEntityOrMappedSuperClass($className)
{ {
if (false !== ($parent = get_parent_class($className))) { if (false !== ($parent = get_parent_class($className))) {
@ -219,45 +339,88 @@ class MappingException extends \Doctrine\ORM\ORMException
)); ));
} }
/**
* @param string $className
* @param string $propertyName
*
* @return MappingException
*/
public static function propertyTypeIsRequired($className, $propertyName) public static function propertyTypeIsRequired($className, $propertyName)
{ {
return new self("The attribute 'type' is required for the column description of property ".$className."::\$".$propertyName."."); return new self("The attribute 'type' is required for the column description of property ".$className."::\$".$propertyName.".");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function tableIdGeneratorNotImplemented($className) public static function tableIdGeneratorNotImplemented($className)
{ {
return new self("TableIdGenerator is not yet implemented for use with class ".$className); return new self("TableIdGenerator is not yet implemented for use with class ".$className);
} }
/** /**
* @param string $entity The entity's name * @param string $entity The entity's name.
* @param string $fieldName The name of the field that was already declared * @param string $fieldName The name of the field that was already declared.
*
* @return MappingException
*/ */
public static function duplicateFieldMapping($entity, $fieldName) public static function duplicateFieldMapping($entity, $fieldName)
{ {
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
* @param string $fieldName
*
* @return MappingException
*/
public static function duplicateAssociationMapping($entity, $fieldName) public static function duplicateAssociationMapping($entity, $fieldName)
{ {
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
* @param string $queryName
*
* @return MappingException
*/
public static function duplicateQueryMapping($entity, $queryName) public static function duplicateQueryMapping($entity, $queryName)
{ {
return new self('Query named "'.$queryName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Query named "'.$queryName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
* @param string $resultName
*
* @return MappingException
*/
public static function duplicateResultSetMapping($entity, $resultName) public static function duplicateResultSetMapping($entity, $resultName)
{ {
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Result set mapping named "'.$resultName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
*
* @return MappingException
*/
public static function singleIdNotAllowedOnCompositePrimaryKey($entity) public static function singleIdNotAllowedOnCompositePrimaryKey($entity)
{ {
return new self('Single id is not allowed on composite primary key in entity '.$entity); return new self('Single id is not allowed on composite primary key in entity '.$entity);
} }
/**
* @param string $entity
* @param string $fieldName
* @param string $unsupportedType
*
* @return MappingException
*/
public static function unsupportedOptimisticLockingType($entity, $fieldName, $unsupportedType) public static function unsupportedOptimisticLockingType($entity, $fieldName, $unsupportedType)
{ {
return new self('Locking type "'.$unsupportedType.'" (specified in "'.$entity.'", field "'.$fieldName.'") ' return new self('Locking type "'.$unsupportedType.'" (specified in "'.$entity.'", field "'.$fieldName.'") '
@ -265,6 +428,11 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string|null $path
*
* @return MappingException
*/
public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null)
{ {
if ( ! empty($path)) { if ( ! empty($path)) {
@ -278,12 +446,13 @@ class MappingException extends \Doctrine\ORM\ORMException
} }
/** /**
* Throws an exception that indicates that a class used in a discriminator map does not exist. * Returns an exception that indicates that a class used in a discriminator map does not exist.
* An example would be an outdated (maybe renamed) classname. * An example would be an outdated (maybe renamed) classname.
* *
* @param string $className The class that could not be found * @param string $className The class that could not be found
* @param string $owningClass The class that declares the discriminator map. * @param string $owningClass The class that declares the discriminator map.
* @return self *
* @return MappingException
*/ */
public static function invalidClassInDiscriminatorMap($className, $owningClass) public static function invalidClassInDiscriminatorMap($className, $owningClass)
{ {
@ -293,6 +462,13 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string $className
* @param array $entries
* @param array $map
*
* @return MappingException
*/
public static function duplicateDiscriminatorEntry($className, array $entries, array $map) public static function duplicateDiscriminatorEntry($className, array $entries, array $map)
{ {
return new self( return new self(
@ -304,46 +480,87 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function missingDiscriminatorMap($className) public static function missingDiscriminatorMap($className)
{ {
return new self("Entity class '$className' is using inheritance but no discriminator map was defined."); return new self("Entity class '$className' is using inheritance but no discriminator map was defined.");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function missingDiscriminatorColumn($className) public static function missingDiscriminatorColumn($className)
{ {
return new self("Entity class '$className' is using inheritance but no discriminator column was defined."); return new self("Entity class '$className' is using inheritance but no discriminator column was defined.");
} }
/**
* @param string $className
* @param string $type
*
* @return MappingException
*/
public static function invalidDiscriminatorColumnType($className, $type) public static function invalidDiscriminatorColumnType($className, $type)
{ {
return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!"); return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForDiscriminatorColumns($className) public static function nameIsMandatoryForDiscriminatorColumns($className)
{ {
return new self("Discriminator column name on entity class '$className' is not defined."); return new self("Discriminator column name on entity class '$className' is not defined.");
} }
/**
* @param string $className
* @param string $fieldName
*
* @return MappingException
*/
public static function cannotVersionIdField($className, $fieldName) public static function cannotVersionIdField($className, $fieldName)
{ {
return new self("Setting Id field '$fieldName' as versionale in entity class '$className' is not supported."); return new self("Setting Id field '$fieldName' as versionale in entity class '$className' is not supported.");
} }
/**
* @param string $className
* @param string $fieldName
* @param string $type
*
* @return MappingException
*/
public static function sqlConversionNotAllowedForIdentifiers($className, $fieldName, $type) public static function sqlConversionNotAllowedForIdentifiers($className, $fieldName, $type)
{ {
return new self("It is not possible to set id field '$fieldName' to type '$type' in entity class '$className'. The type '$type' requires conversion SQL which is not allowed for identifiers."); return new self("It is not possible to set id field '$fieldName' to type '$type' in entity class '$className'. The type '$type' requires conversion SQL which is not allowed for identifiers.");
} }
/** /**
* @param string $className * @param string $className
* @param string $columnName * @param string $columnName
* @return self *
* @return MappingException
*/ */
public static function duplicateColumnName($className, $columnName) public static function duplicateColumnName($className, $columnName)
{ {
return new self("Duplicate definition of column '".$columnName."' on entity '".$className."' in a field or discriminator column mapping."); return new self("Duplicate definition of column '".$columnName."' on entity '".$className."' in a field or discriminator column mapping.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalToManyAssocationOnMappedSuperclass($className, $field) public static function illegalToManyAssocationOnMappedSuperclass($className, $field)
{ {
return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '".$className."#".$field."'."); return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '".$className."#".$field."'.");
@ -353,7 +570,8 @@ class MappingException extends \Doctrine\ORM\ORMException
* @param string $className * @param string $className
* @param string $targetEntity * @param string $targetEntity
* @param string $targetField * @param string $targetField
* @return self *
* @return MappingException
*/ */
public static function cannotMapCompositePrimaryKeyEntitiesAsForeignId($className, $targetEntity, $targetField) public static function cannotMapCompositePrimaryKeyEntitiesAsForeignId($className, $targetEntity, $targetField)
{ {
@ -361,44 +579,91 @@ class MappingException extends \Doctrine\ORM\ORMException
"as part of the primary key of another entity '".$targetEntity."#".$targetField."'."); "as part of the primary key of another entity '".$targetEntity."#".$targetField."'.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function noSingleAssociationJoinColumnFound($className, $field) public static function noSingleAssociationJoinColumnFound($className, $field)
{ {
return new self("'$className#$field' is not an association with a single join column."); return new self("'$className#$field' is not an association with a single join column.");
} }
/**
* @param string $className
* @param string $column
*
* @return MappingException
*/
public static function noFieldNameFoundForColumn($className, $column) public static function noFieldNameFoundForColumn($className, $column)
{ {
return new self("Cannot find a field on '$className' that is mapped to column '$column'. Either the ". return new self("Cannot find a field on '$className' that is mapped to column '$column'. Either the ".
"field does not exist or an association exists but it has multiple join columns."); "field does not exist or an association exists but it has multiple join columns.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field) public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field)
{ {
return new self("The orphan removal option is not allowed on an association that is ". return new self("The orphan removal option is not allowed on an association that is ".
"part of the identifier in '$className#$field'."); "part of the identifier in '$className#$field'.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemoval($className, $field) public static function illegalOrphanRemoval($className, $field)
{ {
return new self("Orphan removal is only allowed on one-to-one and one-to-many ". return new self("Orphan removal is only allowed on one-to-one and one-to-many ".
"associations, but " . $className."#" .$field . " is not."); "associations, but " . $className."#" .$field . " is not.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalInverseIdentifierAssocation($className, $field) public static function illegalInverseIdentifierAssocation($className, $field)
{ {
return new self("An inverse association is not allowed to be identifier in '$className#$field'."); return new self("An inverse association is not allowed to be identifier in '$className#$field'.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalToManyIdentifierAssoaction($className, $field) public static function illegalToManyIdentifierAssoaction($className, $field)
{ {
return new self("Many-to-many or one-to-many associations are not allowed to be identifier in '$className#$field'."); return new self("Many-to-many or one-to-many associations are not allowed to be identifier in '$className#$field'.");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function noInheritanceOnMappedSuperClass($className) public static function noInheritanceOnMappedSuperClass($className)
{ {
return new self("Its not supported to define inheritance information on a mapped superclass '" . $className . "'."); return new self("Its not supported to define inheritance information on a mapped superclass '" . $className . "'.");
} }
/**
* @param string $className
* @param string $rootClassName
*
* @return MappingException
*/
public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName) public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName)
{ {
return new self( return new self(
@ -408,26 +673,57 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string $className
* @param string $methodName
*
* @return MappingException
*/
public static function lifecycleCallbackMethodNotFound($className, $methodName) public static function lifecycleCallbackMethodNotFound($className, $methodName)
{ {
return new self("Entity '" . $className . "' has no method '" . $methodName . "' to be registered as lifecycle callback."); return new self("Entity '" . $className . "' has no method '" . $methodName . "' to be registered as lifecycle callback.");
} }
/**
* @param string $className
* @param string $annotation
*
* @return MappingException
*/
public static function invalidFetchMode($className, $annotation) public static function invalidFetchMode($className, $annotation)
{ {
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'"); return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function compositeKeyAssignedIdGeneratorRequired($className) public static function compositeKeyAssignedIdGeneratorRequired($className)
{ {
return new self("Entity '". $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported."); return new self("Entity '". $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
} }
/**
* @param string $targetEntity
* @param string $sourceEntity
* @param string $associationName
*
* @return MappingException
*/
public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName) public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName)
{ {
return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'."); return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'.");
} }
/**
* @param array $cascades
* @param string $className
* @param string $propertyName
*
* @return MappingException
*/
public static function invalidCascadeOption(array $cascades, $className, $propertyName) public static function invalidCascadeOption(array $cascades, $className, $propertyName)
{ {
$cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades)); $cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));

View File

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class NamedNativeQuery implements Annotation final class NamedNativeQuery implements Annotation
{ {
/** /**
* The name used to refer to the query with the EntityManager methods that create query objects. * The name used to refer to the query with the EntityManager methods that create query objects.
* *
@ -59,5 +58,4 @@ final class NamedNativeQuery implements Annotation
* @var string * @var string
*/ */
public $resultSetMapping; public $resultSetMapping;
} }

View File

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class NamedQueries implements Annotation final class NamedQueries implements Annotation
{ {
/** @var array<\Doctrine\ORM\Mapping\NamedQuery> */ /**
* @var array<\Doctrine\ORM\Mapping\NamedQuery>
*/
public $value; public $value;
} }

View File

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class NamedQuery implements Annotation final class NamedQuery implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $query; public $query;
} }

View File

@ -31,53 +31,58 @@ namespace Doctrine\ORM\Mapping;
interface NamingStrategy interface NamingStrategy
{ {
/** /**
* Return a table name for an entity class * Returns a table name for an entity class.
* *
* @param string $className The fully-qualified class name * @param string $className The fully-qualified class name.
* @return string A table name *
* @return string A table name.
*/ */
function classToTableName($className); function classToTableName($className);
/** /**
* Return a column name for a property * Returns a column name for a property.
* *
* @param string $propertyName A property * @param string $propertyName A property name.
* @param string $className The fully-qualified class name * @param string|null $className The fully-qualified class name.
* @return string A column name *
* @return string A column name.
*/ */
function propertyToColumnName($propertyName, $className = null); function propertyToColumnName($propertyName, $className = null);
/** /**
* Return the default reference column name * Returns the default reference column name.
* *
* @return string A column name * @return string A column name.
*/ */
function referenceColumnName(); function referenceColumnName();
/** /**
* Return a join column name for a property * Returns a join column name for a property.
* *
* @param string $propertyName A property * @param string $propertyName A property name.
* @return string A join column name *
* @return string A join column name.
*/ */
function joinColumnName($propertyName); function joinColumnName($propertyName);
/** /**
* Return a join table name * Returns a join table name.
* *
* @param string $sourceEntity The source entity * @param string $sourceEntity The source entity.
* @param string $targetEntity The target entity * @param string $targetEntity The target entity.
* @param string $propertyName A property * @param string|null $propertyName A property name.
* @return string A join table name *
* @return string A join table name.
*/ */
function joinTableName($sourceEntity, $targetEntity, $propertyName = null); function joinTableName($sourceEntity, $targetEntity, $propertyName = null);
/** /**
* Return the foreign key column name for the given parameters * Returns the foreign key column name for the given parameters.
* *
* @param string $entityName A entity * @param string $entityName An entity.
* @param string $referencedColumnName A property * @param string|null $referencedColumnName A property.
* @return string A join column name *
* @return string A join column name.
*/ */
function joinKeyColumnName($entityName, $referencedColumnName = null); function joinKeyColumnName($entityName, $referencedColumnName = null);
} }

View File

@ -41,7 +41,9 @@ final class OneToMany implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View File

@ -46,7 +46,9 @@ final class OneToOne implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View File

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class OrderBy implements Annotation final class OrderBy implements Annotation
{ {
/** @var array<string> */ /**
* @var array<string>
*/
public $value; public $value;
} }

View File

@ -23,7 +23,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
/** /**
* A set of rules for determining the column, alias and table quotes * A set of rules for determining the column, alias and table quotes.
* *
* @since 2.3 * @since 2.3
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
@ -33,79 +33,87 @@ interface QuoteStrategy
/** /**
* Gets the (possibly quoted) column name for safe use in an SQL statement. * Gets the (possibly quoted) column name for safe use in an SQL statement.
* *
* @param string $fieldName * @param string $fieldName
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform); function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) primary table name for safe use in an SQL statement. * Gets the (possibly quoted) primary table name for safe use in an SQL statement.
* *
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getTableName(ClassMetadata $class, AbstractPlatform $platform); function getTableName(ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) sequence name for safe use in an SQL statement. * Gets the (possibly quoted) sequence name for safe use in an SQL statement.
* *
* @param array $definition * @param array $definition
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform); function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) name of the join table. * Gets the (possibly quoted) name of the join table.
* *
* @param array $association * @param array $association
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform); function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) join column name. * Gets the (possibly quoted) join column name.
* *
* @param array $joinColumn * @param array $joinColumn
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform); function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) join column name. * Gets the (possibly quoted) join column name.
* *
* @param array $joinColumn * @param array $joinColumn
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform); function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) identifier column names for safe use in an SQL statement. * Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
* *
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return array *
* @return array
*/ */
function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform); function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the column alias. * Gets the column alias.
* *
* @param string $columnName * @param string $columnName
* @param integer $counter * @param integer $counter
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @param ClassMetadata $class * @param ClassMetadata|null $class
* @return string *
* @return string
*/ */
function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null); function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);

View File

@ -25,10 +25,18 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class SequenceGenerator implements Annotation final class SequenceGenerator implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $sequenceName; public $sequenceName;
/** @var integer */
/**
* @var integer
*/
public $allocationSize = 1; public $allocationSize = 1;
/** @var integer */
/**
* @var integer
*/
public $initialValue = 1; public $initialValue = 1;
} }

View File

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class SqlResultSetMapping implements Annotation final class SqlResultSetMapping implements Annotation
{ {
/** /**
* The name given to the result set mapping, and used to refer to it in the methods of the Query API. * The name given to the result set mapping, and used to refer to it in the methods of the Query API.
* *
@ -52,5 +51,4 @@ final class SqlResultSetMapping implements Annotation
* @var array<\Doctrine\ORM\Mapping\ColumnResult> * @var array<\Doctrine\ORM\Mapping\ColumnResult>
*/ */
public $columns = array(); public $columns = array();
} }

View File

@ -25,14 +25,28 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Table implements Annotation final class Table implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $schema; public $schema;
/** @var array<\Doctrine\ORM\Mapping\Index> */
/**
* @var array<\Doctrine\ORM\Mapping\Index>
*/
public $indexes; public $indexes;
/** @var array<\Doctrine\ORM\Mapping\UniqueConstraint> */
/**
* @var array<\Doctrine\ORM\Mapping\UniqueConstraint>
*/
public $uniqueConstraints; public $uniqueConstraints;
/** @var array */
/**
* @var array
*/
public $options = array(); public $options = array();
} }

View File

@ -37,7 +37,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
private $case; private $case;
/** /**
* Underscore naming strategy construct * Underscore naming strategy construct.
* *
* @param integer $case CASE_LOWER | CASE_UPPER * @param integer $case CASE_LOWER | CASE_UPPER
*/ */
@ -47,7 +47,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
} }
/** /**
* @return integer * @return integer CASE_LOWER | CASE_UPPER
*/ */
public function getCase() public function getCase()
{ {
@ -55,10 +55,12 @@ class UnderscoreNamingStrategy implements NamingStrategy
} }
/** /**
* Sets string case CASE_LOWER | CASE_UPPER * Sets string case CASE_LOWER | CASE_UPPER.
* Alphabetic characters converted to lowercase or uppercase * Alphabetic characters converted to lowercase or uppercase.
* *
* @param integer $case * @param integer $case
*
* @return void
*/ */
public function setCase($case) public function setCase($case)
{ {
@ -120,6 +122,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
/** /**
* @param string $string * @param string $string
*
* @return string * @return string
*/ */
private function underscore($string) private function underscore($string)

View File

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class UniqueConstraint implements Annotation final class UniqueConstraint implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var array<string> */
/**
* @var array<string>
*/
public $columns; public $columns;
} }

View File

@ -27,12 +27,16 @@ namespace Doctrine\ORM;
*/ */
final class NativeQuery extends AbstractQuery final class NativeQuery extends AbstractQuery
{ {
/**
* @var string
*/
private $_sql; private $_sql;
/** /**
* Sets the SQL of the query. * Sets the SQL of the query.
* *
* @param string $sql * @param string $sql
*
* @return NativeQuery This query instance. * @return NativeQuery This query instance.
*/ */
public function setSQL($sql) public function setSQL($sql)
@ -46,6 +50,7 @@ final class NativeQuery extends AbstractQuery
* Gets the SQL query. * Gets the SQL query.
* *
* @return mixed The built SQL query or an array of all SQL queries. * @return mixed The built SQL query or an array of all SQL queries.
*
* @override * @override
*/ */
public function getSQL() public function getSQL()

View File

@ -27,6 +27,9 @@ namespace Doctrine\ORM;
*/ */
class NoResultException extends UnexpectedResultException class NoResultException extends UnexpectedResultException
{ {
/**
* Constructor.
*/
public function __construct() public function __construct()
{ {
parent::__construct('No result was found for query although at least one row was expected.'); parent::__construct('No result was found for query although at least one row was expected.');

View File

@ -27,5 +27,4 @@ namespace Doctrine\ORM;
*/ */
class NonUniqueResultException extends UnexpectedResultException class NonUniqueResultException extends UnexpectedResultException
{ {
} }

View File

@ -29,22 +29,41 @@ use Exception;
*/ */
class ORMException extends Exception class ORMException extends Exception
{ {
/**
* @return ORMException
*/
public static function missingMappingDriverImpl() public static function missingMappingDriverImpl()
{ {
return new self("It's a requirement to specify a Metadata Driver and pass it ". return new self("It's a requirement to specify a Metadata Driver and pass it ".
"to Doctrine\\ORM\\Configuration::setMetadataDriverImpl()."); "to Doctrine\\ORM\\Configuration::setMetadataDriverImpl().");
} }
/**
* @param string $queryName
*
* @return ORMException
*/
public static function namedQueryNotFound($queryName) public static function namedQueryNotFound($queryName)
{ {
return new self('Could not find a named query by the name "' . $queryName . '"'); return new self('Could not find a named query by the name "' . $queryName . '"');
} }
/**
* @param string $nativeQueryName
*
* @return ORMException
*/
public static function namedNativeQueryNotFound($nativeQueryName) public static function namedNativeQueryNotFound($nativeQueryName)
{ {
return new self('Could not find a named native query by the name "' . $nativeQueryName . '"'); return new self('Could not find a named native query by the name "' . $nativeQueryName . '"');
} }
/**
* @param object $entity
* @param object $relatedEntity
*
* @return ORMException
*/
public static function entityMissingForeignAssignedId($entity, $relatedEntity) public static function entityMissingForeignAssignedId($entity, $relatedEntity)
{ {
return new self( return new self(
@ -56,6 +75,12 @@ class ORMException extends Exception
); );
} }
/**
* @param object $entity
* @param string $field
*
* @return ORMException
*/
public static function entityMissingAssignedIdForField($entity, $field) public static function entityMissingAssignedIdForField($entity, $field)
{ {
return new self("Entity of type " . get_class($entity) . " is missing an assigned ID for field '" . $field . "'. " . return new self("Entity of type " . get_class($entity) . " is missing an assigned ID for field '" . $field . "'. " .
@ -65,6 +90,11 @@ class ORMException extends Exception
); );
} }
/**
* @param string $field
*
* @return ORMException
*/
public static function unrecognizedField($field) public static function unrecognizedField($field)
{ {
return new self("Unrecognized field: $field"); return new self("Unrecognized field: $field");
@ -73,37 +103,67 @@ class ORMException extends Exception
/** /**
* @param string $className * @param string $className
* @param string $field * @param string $field
*
* @return ORMException
*/ */
public static function invalidOrientation($className, $field) public static function invalidOrientation($className, $field)
{ {
return new self("Invalid order by orientation specified for " . $className . "#" . $field); return new self("Invalid order by orientation specified for " . $className . "#" . $field);
} }
/**
* @param string $mode
*
* @return ORMException
*/
public static function invalidFlushMode($mode) public static function invalidFlushMode($mode)
{ {
return new self("'$mode' is an invalid flush mode."); return new self("'$mode' is an invalid flush mode.");
} }
/**
* @return ORMException
*/
public static function entityManagerClosed() public static function entityManagerClosed()
{ {
return new self("The EntityManager is closed."); return new self("The EntityManager is closed.");
} }
/**
* @param string $mode
*
* @return ORMException
*/
public static function invalidHydrationMode($mode) public static function invalidHydrationMode($mode)
{ {
return new self("'$mode' is an invalid hydration mode."); return new self("'$mode' is an invalid hydration mode.");
} }
/**
* @return ORMException
*/
public static function mismatchedEventManager() public static function mismatchedEventManager()
{ {
return new self("Cannot use different EventManager instances for EntityManager and Connection."); return new self("Cannot use different EventManager instances for EntityManager and Connection.");
} }
/**
* @param string $methodName
*
* @return ORMException
*/
public static function findByRequiresParameter($methodName) public static function findByRequiresParameter($methodName)
{ {
return new self("You need to pass a parameter to '".$methodName."'"); return new self("You need to pass a parameter to '".$methodName."'");
} }
/**
* @param string $entityName
* @param string $fieldName
* @param string $method
*
* @return ORMException
*/
public static function invalidFindByCall($entityName, $fieldName, $method) public static function invalidFindByCall($entityName, $fieldName, $method)
{ {
return new self( return new self(
@ -112,6 +172,12 @@ class ORMException extends Exception
); );
} }
/**
* @param string $entityName
* @param string $associationFieldName
*
* @return ORMException
*/
public static function invalidFindByInverseAssociation($entityName, $associationFieldName) public static function invalidFindByInverseAssociation($entityName, $associationFieldName)
{ {
return new self( return new self(
@ -120,29 +186,51 @@ class ORMException extends Exception
); );
} }
public static function invalidResultCacheDriver() { /**
* @return ORMException
*/
public static function invalidResultCacheDriver()
{
return new self("Invalid result cache driver; it must implement Doctrine\\Common\\Cache\\Cache."); return new self("Invalid result cache driver; it must implement Doctrine\\Common\\Cache\\Cache.");
} }
public static function notSupported() { /**
* @return ORMException
*/
public static function notSupported()
{
return new self("This behaviour is (currently) not supported by Doctrine 2"); return new self("This behaviour is (currently) not supported by Doctrine 2");
} }
/**
* @return ORMException
*/
public static function queryCacheNotConfigured() public static function queryCacheNotConfigured()
{ {
return new self('Query Cache is not configured.'); return new self('Query Cache is not configured.');
} }
/**
* @return ORMException
*/
public static function metadataCacheNotConfigured() public static function metadataCacheNotConfigured()
{ {
return new self('Class Metadata Cache is not configured.'); return new self('Class Metadata Cache is not configured.');
} }
/**
* @return ORMException
*/
public static function proxyClassesAlwaysRegenerating() public static function proxyClassesAlwaysRegenerating()
{ {
return new self('Proxy Classes are always regenerating.'); return new self('Proxy Classes are always regenerating.');
} }
/**
* @param string $entityNamespaceAlias
*
* @return ORMException
*/
public static function unknownEntityNamespace($entityNamespaceAlias) public static function unknownEntityNamespace($entityNamespaceAlias)
{ {
return new self( return new self(
@ -150,16 +238,32 @@ class ORMException extends Exception
); );
} }
/**
* @param string $className
*
* @return ORMException
*/
public static function invalidEntityRepository($className) public static function invalidEntityRepository($className)
{ {
return new self("Invalid repository class '".$className."'. It must be a Doctrine\Common\Persistence\ObjectRepository."); return new self("Invalid repository class '".$className."'. It must be a Doctrine\Common\Persistence\ObjectRepository.");
} }
/**
* @param string $className
* @param string $fieldName
*
* @return ORMException
*/
public static function missingIdentifierField($className, $fieldName) public static function missingIdentifierField($className, $fieldName)
{ {
return new self("The identifier $fieldName is missing for a query of " . $className); return new self("The identifier $fieldName is missing for a query of " . $className);
} }
/**
* @param string $functionName
*
* @return ORMException
*/
public static function overwriteInternalDQLFunctionNotAllowed($functionName) public static function overwriteInternalDQLFunctionNotAllowed($functionName)
{ {
return new self("It is not allowed to overwrite internal function '$functionName' in the DQL parser through user-defined functions."); return new self("It is not allowed to overwrite internal function '$functionName' in the DQL parser through user-defined functions.");

View File

@ -26,21 +26,42 @@ namespace Doctrine\ORM;
*/ */
class ORMInvalidArgumentException extends \InvalidArgumentException class ORMInvalidArgumentException extends \InvalidArgumentException
{ {
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function scheduleInsertForManagedEntity($entity) static public function scheduleInsertForManagedEntity($entity)
{ {
return new self("A managed+dirty entity " . self::objToStr($entity) . " can not be scheduled for insertion."); return new self("A managed+dirty entity " . self::objToStr($entity) . " can not be scheduled for insertion.");
} }
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function scheduleInsertForRemovedEntity($entity) static public function scheduleInsertForRemovedEntity($entity)
{ {
return new self("Removed entity " . self::objToStr($entity) . " can not be scheduled for insertion."); return new self("Removed entity " . self::objToStr($entity) . " can not be scheduled for insertion.");
} }
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function scheduleInsertTwice($entity) static public function scheduleInsertTwice($entity)
{ {
return new self("Entity " . self::objToStr($entity) . " can not be scheduled for insertion twice."); return new self("Entity " . self::objToStr($entity) . " can not be scheduled for insertion twice.");
} }
/**
* @param string $className
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function entityWithoutIdentity($className, $entity) static public function entityWithoutIdentity($className, $entity)
{ {
return new self( return new self(
@ -49,11 +70,22 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
); );
} }
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function readOnlyRequiresManagedEntity($entity) static public function readOnlyRequiresManagedEntity($entity)
{ {
return new self("Only managed entities can be marked or checked as read only. But " . self::objToStr($entity) . " is not"); return new self("Only managed entities can be marked or checked as read only. But " . self::objToStr($entity) . " is not");
} }
/**
* @param array $assoc
* @param object $entry
*
* @return ORMInvalidArgumentException
*/
static public function newEntityFoundThroughRelationship(array $assoc, $entry) static public function newEntityFoundThroughRelationship(array $assoc, $entry)
{ {
return new self("A new entity was found through the relationship '" return new self("A new entity was found through the relationship '"
@ -68,6 +100,12 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
." implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue.")); ." implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue."));
} }
/**
* @param array $assoc
* @param object $entry
*
* @return ORMInvalidArgumentException
*/
static public function detachedEntityFoundThroughRelationship(array $assoc, $entry) static public function detachedEntityFoundThroughRelationship(array $assoc, $entry)
{ {
return new self("A detached entity of type " . $assoc['targetEntity'] . " (" . self::objToStr($entry) . ") " return new self("A detached entity of type " . $assoc['targetEntity'] . " (" . self::objToStr($entry) . ") "
@ -75,39 +113,75 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
. "during cascading a persist operation."); . "during cascading a persist operation.");
} }
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function entityNotManaged($entity) static public function entityNotManaged($entity)
{ {
return new self("Entity " . self::objToStr($entity) . " is not managed. An entity is managed if its fetched " . return new self("Entity " . self::objToStr($entity) . " is not managed. An entity is managed if its fetched " .
"from the database or registered as new through EntityManager#persist"); "from the database or registered as new through EntityManager#persist");
} }
/**
* @param object $entity
* @param string $operation
*
* @return ORMInvalidArgumentException
*/
static public function entityHasNoIdentity($entity, $operation) static public function entityHasNoIdentity($entity, $operation)
{ {
return new self("Entity has no identity, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); return new self("Entity has no identity, therefore " . $operation ." cannot be performed. " . self::objToStr($entity));
} }
/**
* @param object $entity
* @param string $operation
*
* @return ORMInvalidArgumentException
*/
static public function entityIsRemoved($entity, $operation) static public function entityIsRemoved($entity, $operation)
{ {
return new self("Entity is removed, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); return new self("Entity is removed, therefore " . $operation ." cannot be performed. " . self::objToStr($entity));
} }
/**
* @param object $entity
* @param string $operation
*
* @return ORMInvalidArgumentException
*/
static public function detachedEntityCannot($entity, $operation) static public function detachedEntityCannot($entity, $operation)
{ {
return new self("A detached entity was found during " . $operation . " " . self::objToStr($entity)); return new self("A detached entity was found during " . $operation . " " . self::objToStr($entity));
} }
/**
* @param string $context
* @param mixed $given
* @param int $parameterIndex
*
* @return ORMInvalidArgumentException
*/
public static function invalidObject($context, $given, $parameterIndex = 1) public static function invalidObject($context, $given, $parameterIndex = 1)
{ {
return new self($context .' expects parameter ' . $parameterIndex . return new self($context . ' expects parameter ' . $parameterIndex .
' to be an entity object, '. gettype($given) . ' given.'); ' to be an entity object, '. gettype($given) . ' given.');
} }
/**
* @return ORMInvalidArgumentException
*/
public static function invalidCompositeIdentifier() public static function invalidCompositeIdentifier()
{ {
return new self("Binding an entity with a composite primary key to a query is not supported. " . return new self("Binding an entity with a composite primary key to a query is not supported. " .
"You should split the parameter into the explicit fields and bind them seperately."); "You should split the parameter into the explicit fields and bind them seperately.");
} }
/**
* @return ORMInvalidArgumentException
*/
public static function invalidIdentifierBindingEntity() public static function invalidIdentifierBindingEntity()
{ {
return new self("Binding entities to query parameters only allowed for entities that have an identifier."); return new self("Binding entities to query parameters only allowed for entities that have an identifier.");
@ -116,7 +190,8 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
/** /**
* Helper method to show an object as string. * Helper method to show an object as string.
* *
* @param object $obj * @param object $obj
*
* @return string * @return string
*/ */
private static function objToStr($obj) private static function objToStr($obj)

View File

@ -29,8 +29,15 @@ namespace Doctrine\ORM;
*/ */
class OptimisticLockException extends ORMException class OptimisticLockException extends ORMException
{ {
/**
* @var object|null
*/
private $entity; private $entity;
/**
* @param string $msg
* @param object $entity
*/
public function __construct($msg, $entity) public function __construct($msg, $entity)
{ {
parent::__construct($msg); parent::__construct($msg);
@ -40,23 +47,40 @@ class OptimisticLockException extends ORMException
/** /**
* Gets the entity that caused the exception. * Gets the entity that caused the exception.
* *
* @return object * @return object|null
*/ */
public function getEntity() public function getEntity()
{ {
return $this->entity; return $this->entity;
} }
/**
* @param object $entity
*
* @return OptimisticLockException
*/
public static function lockFailed($entity) public static function lockFailed($entity)
{ {
return new self("The optimistic lock on an entity failed.", $entity); return new self("The optimistic lock on an entity failed.", $entity);
} }
/**
* @param object $entity
* @param int $expectedLockVersion
* @param int $actualLockVersion
*
* @return OptimisticLockException
*/
public static function lockFailedVersionMissmatch($entity, $expectedLockVersion, $actualLockVersion) public static function lockFailedVersionMissmatch($entity, $expectedLockVersion, $actualLockVersion)
{ {
return new self("The optimistic lock failed, version " . $expectedLockVersion . " was expected, but is actually ".$actualLockVersion, $entity); return new self("The optimistic lock failed, version " . $expectedLockVersion . " was expected, but is actually ".$actualLockVersion, $entity);
} }
/**
* @param string $entityName
*
* @return OptimisticLockException
*/
public static function notVersioned($entityName) public static function notVersioned($entityName)
{ {
return new self("Cannot obtain optimistic lock on unversioned entity " . $entityName, null); return new self("Cannot obtain optimistic lock on unversioned entity " . $entityName, null);

View File

@ -25,7 +25,6 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Selectable; use Doctrine\Common\Collections\Selectable;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ExpressionBuilder;
use Closure; use Closure;
@ -87,6 +86,8 @@ final class PersistentCollection implements Collection, Selectable
/** /**
* The class descriptor of the collection's entity type. * The class descriptor of the collection's entity type.
*
* @var ClassMetadata
*/ */
private $typeClass; private $typeClass;
@ -115,9 +116,9 @@ final class PersistentCollection implements Collection, Selectable
/** /**
* Creates a new persistent collection. * Creates a new persistent collection.
* *
* @param EntityManager $em The EntityManager the collection will be associated with. * @param EntityManager $em The EntityManager the collection will be associated with.
* @param ClassMetadata $class The class descriptor of the entity type of this collection. * @param ClassMetadata $class The class descriptor of the entity type of this collection.
* @param array The collection elements. * @param array $coll The collection elements.
*/ */
public function __construct(EntityManager $em, $class, $coll) public function __construct(EntityManager $em, $class, $coll)
{ {
@ -132,7 +133,9 @@ final class PersistentCollection implements Collection, Selectable
* describes the association between the owner and the elements of the collection. * describes the association between the owner and the elements of the collection.
* *
* @param object $entity * @param object $entity
* @param AssociationMapping $assoc * @param array $assoc
*
* @return void
*/ */
public function setOwner($entity, array $assoc) public function setOwner($entity, array $assoc)
{ {
@ -152,6 +155,9 @@ final class PersistentCollection implements Collection, Selectable
return $this->owner; return $this->owner;
} }
/**
* @return Mapping\ClassMetadata
*/
public function getTypeClass() public function getTypeClass()
{ {
return $this->typeClass; return $this->typeClass;
@ -163,6 +169,8 @@ final class PersistentCollection implements Collection, Selectable
* complete bidirectional associations in the case of a one-to-many association. * complete bidirectional associations in the case of a one-to-many association.
* *
* @param mixed $element The element to add. * @param mixed $element The element to add.
*
* @return void
*/ */
public function hydrateAdd($element) public function hydrateAdd($element)
{ {
@ -186,8 +194,10 @@ final class PersistentCollection implements Collection, Selectable
* INTERNAL: * INTERNAL:
* Sets a keyed element in the collection during hydration. * Sets a keyed element in the collection during hydration.
* *
* @param mixed $key The key to set. * @param mixed $key The key to set.
* $param mixed $value The element to set. * @param mixed $element The element to set.
*
* @return void
*/ */
public function hydrateSet($key, $element) public function hydrateSet($key, $element)
{ {
@ -206,6 +216,8 @@ final class PersistentCollection implements Collection, Selectable
/** /**
* Initializes the collection by loading its contents from the database * Initializes the collection by loading its contents from the database
* if the collection is not yet initialized. * if the collection is not yet initialized.
*
* @return void
*/ */
public function initialize() public function initialize()
{ {
@ -239,6 +251,8 @@ final class PersistentCollection implements Collection, Selectable
/** /**
* INTERNAL: * INTERNAL:
* Tells this collection to take a snapshot of its current state. * Tells this collection to take a snapshot of its current state.
*
* @return void
*/ */
public function takeSnapshot() public function takeSnapshot()
{ {
@ -299,6 +313,8 @@ final class PersistentCollection implements Collection, Selectable
/** /**
* Marks this collection as changed/dirty. * Marks this collection as changed/dirty.
*
* @return void
*/ */
private function changed() private function changed()
{ {
@ -332,6 +348,8 @@ final class PersistentCollection implements Collection, Selectable
* Sets a boolean flag, indicating whether this collection is dirty. * Sets a boolean flag, indicating whether this collection is dirty.
* *
* @param boolean $dirty Whether the collection should be marked dirty or not. * @param boolean $dirty Whether the collection should be marked dirty or not.
*
* @return void
*/ */
public function setDirty($dirty) public function setDirty($dirty)
{ {
@ -342,6 +360,8 @@ final class PersistentCollection implements Collection, Selectable
* Sets the initialized flag of the collection, forcing it into that state. * Sets the initialized flag of the collection, forcing it into that state.
* *
* @param boolean $bool * @param boolean $bool
*
* @return void
*/ */
public function setInitialized($bool) public function setInitialized($bool)
{ {
@ -358,7 +378,9 @@ final class PersistentCollection implements Collection, Selectable
return $this->initialized; return $this->initialized;
} }
/** {@inheritdoc} */ /**
* {@inheritdoc}
*/
public function first() public function first()
{ {
$this->initialize(); $this->initialize();
@ -366,7 +388,9 @@ final class PersistentCollection implements Collection, Selectable
return $this->coll->first(); return $this->coll->first();
} }
/** {@inheritdoc} */ /**
* {@inheritdoc}
*/
public function last() public function last()
{ {
$this->initialize(); $this->initialize();
@ -668,6 +692,8 @@ final class PersistentCollection implements Collection, Selectable
* Called by PHP when this collection is serialized. Ensures that only the * Called by PHP when this collection is serialized. Ensures that only the
* elements are properly serialized. * elements are properly serialized.
* *
* @return array
*
* @internal Tried to implement Serializable first but that did not work well * @internal Tried to implement Serializable first but that did not work well
* with circular references. This solution seems simpler and works well. * with circular references. This solution seems simpler and works well.
*/ */
@ -679,7 +705,7 @@ final class PersistentCollection implements Collection, Selectable
/* ArrayAccess implementation */ /* ArrayAccess implementation */
/** /**
* @see containsKey() * {@inheritdoc}
*/ */
public function offsetExists($offset) public function offsetExists($offset)
{ {
@ -687,7 +713,7 @@ final class PersistentCollection implements Collection, Selectable
} }
/** /**
* @see get() * {@inheritdoc}
*/ */
public function offsetGet($offset) public function offsetGet($offset)
{ {
@ -695,8 +721,7 @@ final class PersistentCollection implements Collection, Selectable
} }
/** /**
* @see add() * {@inheritdoc}
* @see set()
*/ */
public function offsetSet($offset, $value) public function offsetSet($offset, $value)
{ {
@ -708,20 +733,23 @@ final class PersistentCollection implements Collection, Selectable
} }
/** /**
* @see remove() * {@inheritdoc}
*/ */
public function offsetUnset($offset) public function offsetUnset($offset)
{ {
return $this->remove($offset); return $this->remove($offset);
} }
/**
* {@inheritdoc}
*/
public function key() public function key()
{ {
return $this->coll->key(); return $this->coll->key();
} }
/** /**
* Gets the element of the collection at the current iterator position. * {@inheritdoc}
*/ */
public function current() public function current()
{ {
@ -729,7 +757,7 @@ final class PersistentCollection implements Collection, Selectable
} }
/** /**
* Moves the internal iterator position to the next element. * {@inheritdoc}
*/ */
public function next() public function next()
{ {
@ -747,14 +775,14 @@ final class PersistentCollection implements Collection, Selectable
} }
/** /**
* Extract a slice of $length elements starting at position $offset from the Collection. * Extracts a slice of $length elements starting at position $offset from the Collection.
* *
* If $length is null it returns all elements from $offset to the end of the Collection. * If $length is null it returns all elements from $offset to the end of the Collection.
* Keys have to be preserved by this method. Calling this method will only return the * Keys have to be preserved by this method. Calling this method will only return the
* selected slice and NOT change the elements contained in the collection slice is called on. * selected slice and NOT change the elements contained in the collection slice is called on.
* *
* @param int $offset * @param int $offset
* @param int $length * @param int|null $length
* *
* @return array * @return array
*/ */
@ -772,7 +800,7 @@ final class PersistentCollection implements Collection, Selectable
} }
/** /**
* Cleanup internal state of cloned persistent collection. * Cleans up internal state of cloned persistent collection.
* *
* The following problems have to be prevented: * The following problems have to be prevented:
* 1. Added entities are added to old PC * 1. Added entities are added to old PC
@ -781,6 +809,8 @@ final class PersistentCollection implements Collection, Selectable
* 3. Snapshot leads to invalid diffs being generated. * 3. Snapshot leads to invalid diffs being generated.
* 4. Lazy loading grabs entities from old owner object. * 4. Lazy loading grabs entities from old owner object.
* 5. New collection is connected to old owner and leads to duplicate keys. * 5. New collection is connected to old owner and leads to duplicate keys.
*
* @return void
*/ */
public function __clone() public function __clone()
{ {
@ -797,11 +827,14 @@ final class PersistentCollection implements Collection, Selectable
} }
/** /**
* Select all elements from a selectable that match the expression and * Selects all elements from a selectable that match the expression and
* return a new collection containing these elements. * return a new collection containing these elements.
* *
* @param \Doctrine\Common\Collections\Criteria $criteria * @param \Doctrine\Common\Collections\Criteria $criteria
*
* @return Collection * @return Collection
*
* @throws \RuntimeException
*/ */
public function matching(Criteria $criteria) public function matching(Criteria $criteria)
{ {
@ -835,4 +868,3 @@ final class PersistentCollection implements Collection, Selectable
return new ArrayCollection(array_merge($persister->loadCriteria($criteria), $newObjects)); return new ArrayCollection(array_merge($persister->loadCriteria($criteria), $newObjects));
} }
} }

View File

@ -77,6 +77,8 @@ abstract class AbstractCollectionPersister
* Deletes the persistent state represented by the given collection. * Deletes the persistent state represented by the given collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/ */
public function delete(PersistentCollection $coll) public function delete(PersistentCollection $coll)
{ {
@ -95,6 +97,8 @@ abstract class AbstractCollectionPersister
* Gets the SQL statement for deleting the given collection. * Gets the SQL statement for deleting the given collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/ */
abstract protected function getDeleteSQL(PersistentCollection $coll); abstract protected function getDeleteSQL(PersistentCollection $coll);
@ -103,14 +107,18 @@ abstract class AbstractCollectionPersister
* the given collection. * the given collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/ */
abstract protected function getDeleteSQLParameters(PersistentCollection $coll); abstract protected function getDeleteSQLParameters(PersistentCollection $coll);
/** /**
* Updates the given collection, synchronizing it's state with the database * Updates the given collection, synchronizing its state with the database
* by inserting, updating and deleting individual elements. * by inserting, updating and deleting individual elements.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/ */
public function update(PersistentCollection $coll) public function update(PersistentCollection $coll)
{ {
@ -125,9 +133,11 @@ abstract class AbstractCollectionPersister
} }
/** /**
* Delete rows * Deletes rows.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/ */
public function deleteRows(PersistentCollection $coll) public function deleteRows(PersistentCollection $coll)
{ {
@ -140,9 +150,11 @@ abstract class AbstractCollectionPersister
} }
/** /**
* Insert rows * Inserts rows.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/ */
public function insertRows(PersistentCollection $coll) public function insertRows(PersistentCollection $coll)
{ {
@ -155,11 +167,13 @@ abstract class AbstractCollectionPersister
} }
/** /**
* Count the size of this persistent collection * Counts the size of this persistent collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* *
* @return integer * @return integer
*
* @throws \BadMethodCallException
*/ */
public function count(PersistentCollection $coll) public function count(PersistentCollection $coll)
{ {
@ -167,13 +181,15 @@ abstract class AbstractCollectionPersister
} }
/** /**
* Slice elements * Slices elements.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param integer $offset * @param integer $offset
* @param integer $length * @param integer $length
* *
* @return array * @return array
*
* @throws \BadMethodCallException
*/ */
public function slice(PersistentCollection $coll, $offset, $length = null) public function slice(PersistentCollection $coll, $offset, $length = null)
{ {
@ -181,38 +197,44 @@ abstract class AbstractCollectionPersister
} }
/** /**
* Check for existance of an element * Checks for existence of an element.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
* *
* @return boolean * @return boolean
*
* @throws \BadMethodCallException
*/ */
public function contains(PersistentCollection $coll, $element) public function contains(PersistentCollection $coll, $element)
{ {
throw new \BadMethodCallException("Checking for existance of an element is not supported by this CollectionPersister."); throw new \BadMethodCallException("Checking for existence of an element is not supported by this CollectionPersister.");
} }
/** /**
* Check for existance of a key * Checks for existence of a key.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $key * @param mixed $key
* *
* @return boolean * @return boolean
*
* @throws \BadMethodCallException
*/ */
public function containsKey(PersistentCollection $coll, $key) public function containsKey(PersistentCollection $coll, $key)
{ {
throw new \BadMethodCallException("Checking for existance of a key is not supported by this CollectionPersister."); throw new \BadMethodCallException("Checking for existence of a key is not supported by this CollectionPersister.");
} }
/** /**
* Remove an element * Removes an element.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
* *
* @return mixed * @return mixed
*
* @throws \BadMethodCallException
*/ */
public function removeElement(PersistentCollection $coll, $element) public function removeElement(PersistentCollection $coll, $element)
{ {
@ -220,11 +242,14 @@ abstract class AbstractCollectionPersister
} }
/** /**
* Remove an element by key * Removes an element by key.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $key
* *
* @param mixed $key * @return void
*
* @throws \BadMethodCallException
*/ */
public function removeKey(PersistentCollection $coll, $key) public function removeKey(PersistentCollection $coll, $key)
{ {
@ -232,12 +257,14 @@ abstract class AbstractCollectionPersister
} }
/** /**
* Get an element by key * Gets an element by key.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $index * @param mixed $index
* *
* @return mixed * @return mixed
*
* @throws \BadMethodCallException
*/ */
public function get(PersistentCollection $coll, $index) public function get(PersistentCollection $coll, $index)
{ {
@ -248,6 +275,8 @@ abstract class AbstractCollectionPersister
* Gets the SQL statement used for deleting a row from the collection. * Gets the SQL statement used for deleting a row from the collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return string
*/ */
abstract protected function getDeleteRowSQL(PersistentCollection $coll); abstract protected function getDeleteRowSQL(PersistentCollection $coll);
@ -256,7 +285,9 @@ abstract class AbstractCollectionPersister
* element from the given collection. * element from the given collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $element * @param mixed $element
*
* @return array
*/ */
abstract protected function getDeleteRowSQLParameters(PersistentCollection $coll, $element); abstract protected function getDeleteRowSQLParameters(PersistentCollection $coll, $element);
@ -264,6 +295,8 @@ abstract class AbstractCollectionPersister
* Gets the SQL statement used for updating a row in the collection. * Gets the SQL statement used for updating a row in the collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return string
*/ */
abstract protected function getUpdateRowSQL(PersistentCollection $coll); abstract protected function getUpdateRowSQL(PersistentCollection $coll);
@ -271,6 +304,8 @@ abstract class AbstractCollectionPersister
* Gets the SQL statement used for inserting a row in the collection. * Gets the SQL statement used for inserting a row in the collection.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return string
*/ */
abstract protected function getInsertRowSQL(PersistentCollection $coll); abstract protected function getInsertRowSQL(PersistentCollection $coll);
@ -279,7 +314,9 @@ abstract class AbstractCollectionPersister
* element of the given collection into the database. * element of the given collection into the database.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $element * @param mixed $element
*
* @return array
*/ */
abstract protected function getInsertRowSQLParameters(PersistentCollection $coll, $element); abstract protected function getInsertRowSQLParameters(PersistentCollection $coll, $element);
} }

View File

@ -76,6 +76,13 @@ abstract class AbstractEntityInheritancePersister extends BasicEntityPersister
return $sql . ' AS ' . $columnAlias; return $sql . ' AS ' . $columnAlias;
} }
/**
* @param string $tableAlias
* @param string $joinColumnName
* @param string $className
*
* @return string
*/
protected function getSelectJoinColumnSQL($tableAlias, $joinColumnName, $className) protected function getSelectJoinColumnSQL($tableAlias, $joinColumnName, $className)
{ {
$columnAlias = $this->getSQLColumnAlias($joinColumnName); $columnAlias = $this->getSQLColumnAlias($joinColumnName);

View File

@ -144,6 +144,7 @@ class BasicEntityPersister
* when INSERTing or UPDATEing an entity. * when INSERTing or UPDATEing an entity.
* *
* @var array * @var array
*
* @see prepareInsertData($entity) * @see prepareInsertData($entity)
* @see prepareUpdateData($entity) * @see prepareUpdateData($entity)
*/ */
@ -153,6 +154,7 @@ class BasicEntityPersister
* The map of quoted column names. * The map of quoted column names.
* *
* @var array * @var array
*
* @see prepareInsertData($entity) * @see prepareInsertData($entity)
* @see prepareUpdateData($entity) * @see prepareUpdateData($entity)
*/ */
@ -207,7 +209,7 @@ class BasicEntityPersister
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager * Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
* and persists instances of the class described by the given ClassMetadata descriptor. * and persists instances of the class described by the given ClassMetadata descriptor.
* *
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
* @param \Doctrine\ORM\Mapping\ClassMetadata $class * @param \Doctrine\ORM\Mapping\ClassMetadata $class
*/ */
public function __construct(EntityManager $em, ClassMetadata $class) public function __construct(EntityManager $em, ClassMetadata $class)
@ -232,6 +234,8 @@ class BasicEntityPersister
* The entity remains queued until {@link executeInserts} is invoked. * The entity remains queued until {@link executeInserts} is invoked.
* *
* @param object $entity The entity to queue for insertion. * @param object $entity The entity to queue for insertion.
*
* @return void
*/ */
public function addInsert($entity) public function addInsert($entity)
{ {
@ -297,7 +301,9 @@ class BasicEntityPersister
* entities version field. * entities version field.
* *
* @param object $entity * @param object $entity
* @param mixed $id * @param mixed $id
*
* @return void
*/ */
protected function assignDefaultVersionValue($entity, $id) protected function assignDefaultVersionValue($entity, $id)
{ {
@ -307,10 +313,11 @@ class BasicEntityPersister
} }
/** /**
* Fetch the current version value of a versioned entity. * Fetches the current version value of a versioned entity.
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $versionedClass * @param \Doctrine\ORM\Mapping\ClassMetadata $versionedClass
* @param mixed $id * @param mixed $id
*
* @return mixed * @return mixed
*/ */
protected function fetchVersionValue($versionedClass, $id) protected function fetchVersionValue($versionedClass, $id)
@ -343,6 +350,8 @@ class BasicEntityPersister
* from {@prepareUpdateData} on the target tables, thereby optionally applying versioning. * from {@prepareUpdateData} on the target tables, thereby optionally applying versioning.
* *
* @param object $entity The entity to update. * @param object $entity The entity to update.
*
* @return void
*/ */
public function update($entity) public function update($entity)
{ {
@ -369,10 +378,15 @@ class BasicEntityPersister
* Performs an UPDATE statement for an entity on a specific table. * Performs an UPDATE statement for an entity on a specific table.
* The UPDATE can optionally be versioned, which requires the entity to have a version field. * The UPDATE can optionally be versioned, which requires the entity to have a version field.
* *
* @param object $entity The entity object being updated. * @param object $entity The entity object being updated.
* @param string $quotedTableName The quoted name of the table to apply the UPDATE on. * @param string $quotedTableName The quoted name of the table to apply the UPDATE on.
* @param array $updateData The map of columns to update (column => value). * @param array $updateData The map of columns to update (column => value).
* @param boolean $versioned Whether the UPDATE should be versioned. * @param boolean $versioned Whether the UPDATE should be versioned.
*
* @return void
*
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
*/ */
protected final function updateTable($entity, $quotedTableName, array $updateData, $versioned = false) protected final function updateTable($entity, $quotedTableName, array $updateData, $versioned = false)
{ {
@ -472,7 +486,9 @@ class BasicEntityPersister
/** /**
* @todo Add check for platform if it supports foreign keys/cascading. * @todo Add check for platform if it supports foreign keys/cascading.
*
* @param array $identifier * @param array $identifier
*
* @return void * @return void
*/ */
protected function deleteJoinTableRecords($identifier) protected function deleteJoinTableRecords($identifier)
@ -538,6 +554,8 @@ class BasicEntityPersister
* Subclasses may override this method to customize the semantics of entity deletion. * Subclasses may override this method to customize the semantics of entity deletion.
* *
* @param object $entity The entity to delete. * @param object $entity The entity to delete.
*
* @return void
*/ */
public function delete($entity) public function delete($entity)
{ {
@ -568,6 +586,7 @@ class BasicEntityPersister
* </code> * </code>
* *
* @param object $entity The entity for which to prepare the data. * @param object $entity The entity for which to prepare the data.
*
* @return array The prepared data. * @return array The prepared data.
*/ */
protected function prepareUpdateData($entity) protected function prepareUpdateData($entity)
@ -658,7 +677,9 @@ class BasicEntityPersister
* The default insert data preparation is the same as for updates. * The default insert data preparation is the same as for updates.
* *
* @param object $entity The entity for which to prepare the data. * @param object $entity The entity for which to prepare the data.
*
* @return array The prepared data for the tables to update. * @return array The prepared data for the tables to update.
*
* @see prepareUpdateData * @see prepareUpdateData
*/ */
protected function prepareInsertData($entity) protected function prepareInsertData($entity)
@ -674,6 +695,7 @@ class BasicEntityPersister
* is always persisted to a single table with a BasicEntityPersister. * is always persisted to a single table with a BasicEntityPersister.
* *
* @param string $fieldName The field name. * @param string $fieldName The field name.
*
* @return string The table name. * @return string The table name.
*/ */
public function getOwningTable($fieldName) public function getOwningTable($fieldName)
@ -684,15 +706,16 @@ class BasicEntityPersister
/** /**
* Loads an entity by a list of field criteria. * Loads an entity by a list of field criteria.
* *
* @param array $criteria The criteria by which to load the entity. * @param array $criteria The criteria by which to load the entity.
* @param object $entity The entity to load the data into. If not specified, * @param object|null $entity The entity to load the data into. If not specified, a new entity is created.
* a new entity is created. * @param array|null $assoc The association that connects the entity to load to another entity, if any.
* @param $assoc The association that connects the entity to load to another entity, if any. * @param array $hints Hints for entity creation.
* @param array $hints Hints for entity creation. * @param int $lockMode
* @param int $lockMode * @param int|null $limit Limit number of results.
* @param int $limit Limit number of results * @param array|null $orderBy Criteria to order by.
* @param array $orderBy Criteria to order by *
* @return object The loaded and managed entity instance or NULL if the entity can not be found. * @return object The loaded and managed entity instance or NULL if the entity can not be found.
*
* @todo Check identity map? loadById method? Try to guess whether $criteria is the id? * @todo Check identity map? loadById method? Try to guess whether $criteria is the id?
*/ */
public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = 0, $limit = null, array $orderBy = null) public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = 0, $limit = null, array $orderBy = null)
@ -716,12 +739,15 @@ class BasicEntityPersister
* Loads an entity of this persister's mapped class as part of a single-valued * Loads an entity of this persister's mapped class as part of a single-valued
* association from another entity. * association from another entity.
* *
* @param array $assoc The association to load. * @param array $assoc The association to load.
* @param object $sourceEntity The entity that owns the association (not necessarily the "owning side"). * @param object $sourceEntity The entity that owns the association (not necessarily the "owning side").
* @param array $identifier The identifier of the entity to load. Must be provided if * @param array $identifier The identifier of the entity to load. Must be provided if
* the association to load represents the owning side, otherwise * the association to load represents the owning side, otherwise
* the identifier is derived from the $sourceEntity. * the identifier is derived from the $sourceEntity.
*
* @return object The loaded and managed entity instance or NULL if the entity can not be found. * @return object The loaded and managed entity instance or NULL if the entity can not be found.
*
* @throws \Doctrine\ORM\Mapping\MappingException
*/ */
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = array()) public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = array())
{ {
@ -789,9 +815,12 @@ class BasicEntityPersister
/** /**
* Refreshes a managed entity. * Refreshes a managed entity.
* *
* @param array $id The identifier of the entity as an associative array from * @param array $id The identifier of the entity as an associative array from
* column or field names to values. * column or field names to values.
* @param object $entity The entity to refresh. * @param object $entity The entity to refresh.
* @param int $lockMode
*
* @return void
*/ */
public function refresh(array $id, $entity, $lockMode = 0) public function refresh(array $id, $entity, $lockMode = 0)
{ {
@ -804,7 +833,7 @@ class BasicEntityPersister
} }
/** /**
* Load Entities matching the given Criteria object * Loads Entities matching the given Criteria object.
* *
* @param \Doctrine\Common\Collections\Criteria $criteria * @param \Doctrine\Common\Collections\Criteria $criteria
* *
@ -826,7 +855,7 @@ class BasicEntityPersister
} }
/** /**
* Expand Criteria Parameters by walking the expressions and grabbing all * Expands Criteria Parameters by walking the expressions and grabbing all
* parameters and types from it. * parameters and types from it.
* *
* @param \Doctrine\Common\Collections\Criteria $criteria * @param \Doctrine\Common\Collections\Criteria $criteria
@ -864,10 +893,11 @@ class BasicEntityPersister
/** /**
* Loads a list of entities by a list of field criteria. * Loads a list of entities by a list of field criteria.
* *
* @param array $criteria * @param array $criteria
* @param array $orderBy * @param array|null $orderBy
* @param int $limit * @param int|null $limit
* @param int $offset * @param int|null $offset
*
* @return array * @return array
*/ */
public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null) public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
@ -882,12 +912,13 @@ class BasicEntityPersister
} }
/** /**
* Get (sliced or full) elements of the given collection. * Gets (sliced or full) elements of the given collection.
* *
* @param array $assoc * @param array $assoc
* @param object $sourceEntity * @param object $sourceEntity
* @param int|null $offset * @param int|null $offset
* @param int|null $limit * @param int|null $limit
*
* @return array * @return array
*/ */
public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null) public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
@ -898,9 +929,9 @@ class BasicEntityPersister
} }
/** /**
* Load an array of entities from a given dbal statement. * Loads an array of entities from a given DBAL statement.
* *
* @param array $assoc * @param array $assoc
* @param \Doctrine\DBAL\Statement $stmt * @param \Doctrine\DBAL\Statement $stmt
* *
* @return array * @return array
@ -919,11 +950,11 @@ class BasicEntityPersister
} }
/** /**
* Hydrate a collection from a given dbal statement. * Hydrates a collection from a given DBAL statement.
* *
* @param array $assoc * @param array $assoc
* @param \Doctrine\DBAL\Statement $stmt * @param \Doctrine\DBAL\Statement $stmt
* @param PersistentCollection $coll * @param PersistentCollection $coll
* *
* @return array * @return array
*/ */
@ -946,11 +977,10 @@ class BasicEntityPersister
/** /**
* Loads a collection of entities of a many-to-many association. * Loads a collection of entities of a many-to-many association.
* *
* @param ManyToManyMapping $assoc The association mapping of the association being loaded. * @param array $assoc The association mapping of the association being loaded.
* @param object $sourceEntity The entity that owns the collection. * @param object $sourceEntity The entity that owns the collection.
* @param PersistentCollection $coll The collection to fill. * @param PersistentCollection $coll The collection to fill.
* @param int|null $offset *
* @param int|null $limit
* @return array * @return array
*/ */
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll) public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
@ -960,6 +990,16 @@ class BasicEntityPersister
return $this->loadCollectionFromStatement($assoc, $stmt, $coll); return $this->loadCollectionFromStatement($assoc, $stmt, $coll);
} }
/**
* @param array $assoc
* @param object $sourceEntity
* @param int|null $offset
* @param int|null $limit
*
* @return \Doctrine\DBAL\Driver\Statement
*
* @throws \Doctrine\ORM\Mapping\MappingException
*/
private function getManyToManyStatement(array $assoc, $sourceEntity, $offset = null, $limit = null) private function getManyToManyStatement(array $assoc, $sourceEntity, $offset = null, $limit = null)
{ {
$sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']); $sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']);
@ -1021,12 +1061,12 @@ class BasicEntityPersister
* Gets the SELECT SQL to select one or more entities by a set of field criteria. * Gets the SELECT SQL to select one or more entities by a set of field criteria.
* *
* @param array|\Doctrine\Common\Collections\Criteria $criteria * @param array|\Doctrine\Common\Collections\Criteria $criteria
* @param AssociationMapping $assoc * @param array|null $assoc
* @param string $orderBy * @param int $lockMode
* @param int $lockMode * @param int|null $limit
* @param int $limit * @param int|null $offset
* @param int $offset * @param array|null $orderBy
* @param array $orderBy *
* @return string * @return string
*/ */
protected function getSelectSQL($criteria, $assoc = null, $lockMode = 0, $limit = null, $offset = null, array $orderBy = null) protected function getSelectSQL($criteria, $assoc = null, $lockMode = 0, $limit = null, $offset = null, array $orderBy = null)
@ -1089,9 +1129,12 @@ class BasicEntityPersister
/** /**
* Gets the ORDER BY SQL snippet for ordered collections. * Gets the ORDER BY SQL snippet for ordered collections.
* *
* @param array $orderBy * @param array $orderBy
* @param string $baseTableAlias * @param string $baseTableAlias
*
* @return string * @return string
*
* @throws \Doctrine\ORM\ORMException
*/ */
protected final function getOrderBySQL(array $orderBy, $baseTableAlias) protected final function getOrderBySQL(array $orderBy, $baseTableAlias)
{ {
@ -1235,10 +1278,10 @@ class BasicEntityPersister
/** /**
* Gets the SQL join fragment used when selecting entities from an association. * Gets the SQL join fragment used when selecting entities from an association.
* *
* @param string $field * @param string $field
* @param array $assoc * @param array $assoc
* @param ClassMetadata $class * @param ClassMetadata $class
* @param string $alias * @param string $alias
* *
* @return string * @return string
*/ */
@ -1267,7 +1310,8 @@ class BasicEntityPersister
* Gets the SQL join fragment used when selecting entities from a * Gets the SQL join fragment used when selecting entities from a
* many-to-many association. * many-to-many association.
* *
* @param ManyToManyMapping $manyToMany * @param array $manyToMany
*
* @return string * @return string
*/ */
protected function getSelectManyToManyJoinSQL(array $manyToMany) protected function getSelectManyToManyJoinSQL(array $manyToMany)
@ -1381,10 +1425,12 @@ class BasicEntityPersister
/** /**
* Gets the SQL snippet of a qualified column name for the given field name. * Gets the SQL snippet of a qualified column name for the given field name.
* *
* @param string $field The field name. * @param string $field The field name.
* @param ClassMetadata $class The class that declares this field. The table this class is * @param ClassMetadata $class The class that declares this field. The table this class is
* mapped to must own the column for the given field. * mapped to must own the column for the given field.
* @param string $alias * @param string $alias
*
* @return string
*/ */
protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r') protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r')
{ {
@ -1408,7 +1454,10 @@ class BasicEntityPersister
* Gets the SQL table alias for the given class name. * Gets the SQL table alias for the given class name.
* *
* @param string $className * @param string $className
* @param string $assocName
*
* @return string The SQL table alias. * @return string The SQL table alias.
*
* @todo Reconsider. Binding table aliases to class names is not such a good idea. * @todo Reconsider. Binding table aliases to class names is not such a good idea.
*/ */
protected function getSQLTableAlias($className, $assocName = '') protected function getSQLTableAlias($className, $assocName = '')
@ -1429,10 +1478,11 @@ class BasicEntityPersister
} }
/** /**
* Lock all rows of this entity matching the given criteria with the specified pessimistic lock mode * Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode.
* *
* @param array $criteria * @param array $criteria
* @param int $lockMode * @param int $lockMode
*
* @return void * @return void
*/ */
public function lock(array $criteria, $lockMode) public function lock(array $criteria, $lockMode)
@ -1464,7 +1514,7 @@ class BasicEntityPersister
} }
/** /**
* Get the FROM and optionally JOIN conditions to lock the entity managed by this persister. * Gets the FROM and optionally JOIN conditions to lock the entity managed by this persister.
* *
* @return string * @return string
*/ */
@ -1476,9 +1526,10 @@ class BasicEntityPersister
} }
/** /**
* Get the Select Where Condition from a Criteria object. * Gets the Select Where Condition from a Criteria object.
* *
* @param \Doctrine\Common\Collections\Criteria $criteria * @param \Doctrine\Common\Collections\Criteria $criteria
*
* @return string * @return string
*/ */
protected function getSelectConditionCriteriaSQL(Criteria $criteria) protected function getSelectConditionCriteriaSQL(Criteria $criteria)
@ -1495,12 +1546,12 @@ class BasicEntityPersister
} }
/** /**
* Get the SQL WHERE condition for matching a field with a given value. * Gets the SQL WHERE condition for matching a field with a given value.
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array|null $assoc * @param array|null $assoc
* @param string $comparison * @param string|null $comparison
* *
* @return string * @return string
*/ */
@ -1529,12 +1580,14 @@ class BasicEntityPersister
} }
/** /**
* Build the left-hand-side of a where condition statement. * Builds the left-hand-side of a where condition statement.
* *
* @param string $field * @param string $field
* @param array $assoc * @param array|null $assoc
* *
* @return string * @return string
*
* @throws \Doctrine\ORM\ORMException
*/ */
protected function getSelectConditionStatementColumnSQL($field, $assoc = null) protected function getSelectConditionStatementColumnSQL($field, $assoc = null)
{ {
@ -1578,8 +1631,9 @@ class BasicEntityPersister
* Subclasses are supposed to override this method if they intend to change * Subclasses are supposed to override this method if they intend to change
* or alter the criteria by which entities are selected. * or alter the criteria by which entities are selected.
* *
* @param array $criteria * @param array $criteria
* @param AssociationMapping $assoc * @param array|null $assoc
*
* @return string * @return string
*/ */
protected function getSelectConditionSQL(array $criteria, $assoc = null) protected function getSelectConditionSQL(array $criteria, $assoc = null)
@ -1594,12 +1648,13 @@ class BasicEntityPersister
} }
/** /**
* Return an array with (sliced or full list) of elements in the specified collection. * Returns an array with (sliced or full list) of elements in the specified collection.
*
* @param array $assoc
* @param object $sourceEntity
* @param int|null $offset
* @param int|null $limit
* *
* @param array $assoc
* @param object $sourceEntity
* @param int $offset
* @param int $limit
* @return array * @return array
*/ */
public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null) public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
@ -1612,11 +1667,11 @@ class BasicEntityPersister
/** /**
* Loads a collection of entities in a one-to-many association. * Loads a collection of entities in a one-to-many association.
* *
* @param array $assoc * @param array $assoc
* @param object $sourceEntity * @param object $sourceEntity
* @param PersistentCollection $coll The collection to load/fill. * @param PersistentCollection $coll The collection to load/fill.
* @param int|null $offset *
* @param int|null $limit * @return array
*/ */
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll) public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
{ {
@ -1626,12 +1681,13 @@ class BasicEntityPersister
} }
/** /**
* Build criteria and execute SQL statement to fetch the one to many entities from. * Builds criteria and execute SQL statement to fetch the one to many entities from.
* *
* @param array $assoc * @param array $assoc
* @param object $sourceEntity * @param object $sourceEntity
* @param int|null $offset * @param int|null $offset
* @param int|null $limit * @param int|null $limit
*
* @return \Doctrine\DBAL\Statement * @return \Doctrine\DBAL\Statement
*/ */
private function getOneToManyStatement(array $assoc, $sourceEntity, $offset = null, $limit = null) private function getOneToManyStatement(array $assoc, $sourceEntity, $offset = null, $limit = null)
@ -1667,9 +1723,10 @@ class BasicEntityPersister
} }
/** /**
* Expand the parameters from the given criteria and use the correct binding types if found. * Expands the parameters from the given criteria and use the correct binding types if found.
*
* @param array $criteria
* *
* @param array $criteria
* @return array * @return array
*/ */
private function expandParameters($criteria) private function expandParameters($criteria)
@ -1690,11 +1747,14 @@ class BasicEntityPersister
} }
/** /**
* Infer field type to be used by parameter type casting. * Infers field type to be used by parameter type casting.
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
*
* @return integer * @return integer
*
* @throws \Doctrine\ORM\Query\QueryException
*/ */
private function getType($field, $value) private function getType($field, $value)
{ {
@ -1733,9 +1793,10 @@ class BasicEntityPersister
} }
/** /**
* Retrieve parameter value * Retrieves parameter value.
* *
* @param mixed $value * @param mixed $value
*
* @return mixed * @return mixed
*/ */
private function getValue($value) private function getValue($value)
@ -1754,9 +1815,10 @@ class BasicEntityPersister
} }
/** /**
* Retrieve an individual parameter value * Retrieves an individual parameter value.
* *
* @param mixed $value * @param mixed $value
*
* @return mixed * @return mixed
*/ */
private function getIndividualValue($value) private function getIndividualValue($value)
@ -1781,6 +1843,8 @@ class BasicEntityPersister
* Checks whether the given managed entity exists in the database. * Checks whether the given managed entity exists in the database.
* *
* @param object $entity * @param object $entity
* @param array $extraConditions
*
* @return boolean TRUE if the entity exists in the database, FALSE otherwise. * @return boolean TRUE if the entity exists in the database, FALSE otherwise.
*/ */
public function exists($entity, array $extraConditions = array()) public function exists($entity, array $extraConditions = array())
@ -1814,6 +1878,7 @@ class BasicEntityPersister
* Generates the appropriate join SQL for the given join column. * Generates the appropriate join SQL for the given join column.
* *
* @param array $joinColumns The join columns definition of an association. * @param array $joinColumns The join columns definition of an association.
*
* @return string LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise. * @return string LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise.
*/ */
protected function getJoinSQLForJoinColumns($joinColumns) protected function getJoinSQLForJoinColumns($joinColumns)
@ -1832,6 +1897,7 @@ class BasicEntityPersister
* Gets an SQL column alias for a column name. * Gets an SQL column alias for a column name.
* *
* @param string $columnName * @param string $columnName
*
* @return string * @return string
*/ */
public function getSQLColumnAlias($columnName) public function getSQLColumnAlias($columnName)
@ -1842,8 +1908,8 @@ class BasicEntityPersister
/** /**
* Generates the filter SQL for a given entity and table alias. * Generates the filter SQL for a given entity and table alias.
* *
* @param ClassMetadata $targetEntity Metadata of the target entity. * @param ClassMetadata $targetEntity Metadata of the target entity.
* @param string $targetTableAlias The table alias of the joined/selected table. * @param string $targetTableAlias The table alias of the joined/selected table.
* *
* @return string The SQL query part to add to a query. * @return string The SQL query part to add to a query.
*/ */

View File

@ -26,5 +26,4 @@ namespace Doctrine\ORM\Persisters;
*/ */
abstract class ElementCollectionPersister extends AbstractCollectionPersister abstract class ElementCollectionPersister extends AbstractCollectionPersister
{ {
} }

View File

@ -87,7 +87,9 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
* Gets the name of the table that owns the column the given field is mapped to. * Gets the name of the table that owns the column the given field is mapped to.
* *
* @param string $fieldName * @param string $fieldName
*
* @return string * @return string
*
* @override * @override
*/ */
public function getOwningTable($fieldName) public function getOwningTable($fieldName)
@ -408,8 +410,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
return 'FROM ' . $quotedTableName . ' ' . $baseTableAlias . $joinSql; return 'FROM ' . $quotedTableName . ' ' . $baseTableAlias . $joinSql;
} }
/* /**
* Ensure this method is never called. This persister overrides getSelectEntitiesSQL directly. * Ensure this method is never called. This persister overrides getSelectEntitiesSQL directly.
*
* @return string
*/ */
protected function getSelectColumnsSQL() protected function getSelectColumnsSQL()
{ {
@ -548,5 +552,4 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
$value = $this->fetchVersionValue($this->getVersionedClassMetadata(), $id); $value = $this->fetchVersionValue($this->getVersionedClassMetadata(), $id);
$this->class->setFieldValue($entity, $this->class->versionField, $value); $this->class->setFieldValue($entity, $this->class->versionField, $value);
} }
} }

View File

@ -61,6 +61,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc} * {@inheritdoc}
* *
* @override * @override
*
* @internal Order of the parameters must be the same as the order of the columns in getDeleteRowSql. * @internal Order of the parameters must be the same as the order of the columns in getDeleteRowSql.
*/ */
protected function getDeleteRowSQLParameters(PersistentCollection $coll, $element) protected function getDeleteRowSQLParameters(PersistentCollection $coll, $element)
@ -82,6 +83,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc} * {@inheritdoc}
* *
* @override * @override
*
* @internal Order of the parameters must be the same as the order of the columns in getInsertRowSql. * @internal Order of the parameters must be the same as the order of the columns in getInsertRowSql.
*/ */
protected function getInsertRowSQL(PersistentCollection $coll) protected function getInsertRowSQL(PersistentCollection $coll)
@ -107,6 +109,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc} * {@inheritdoc}
* *
* @override * @override
*
* @internal Order of the parameters must be the same as the order of the columns in getInsertRowSql. * @internal Order of the parameters must be the same as the order of the columns in getInsertRowSql.
*/ */
protected function getInsertRowSQLParameters(PersistentCollection $coll, $element) protected function getInsertRowSQLParameters(PersistentCollection $coll, $element)
@ -119,7 +122,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
* of the join table columns as specified in ManyToManyMapping#joinTableColumns. * of the join table columns as specified in ManyToManyMapping#joinTableColumns.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
*
* @return array * @return array
*/ */
private function collectJoinTableColumnParameters(PersistentCollection $coll, $element) private function collectJoinTableColumnParameters(PersistentCollection $coll, $element)
@ -181,6 +185,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc} * {@inheritdoc}
* *
* @override * @override
*
* @internal Order of the parameters must be the same as the order of the columns in getDeleteSql. * @internal Order of the parameters must be the same as the order of the columns in getDeleteSql.
*/ */
protected function getDeleteSQLParameters(PersistentCollection $coll) protected function getDeleteSQLParameters(PersistentCollection $coll)
@ -253,8 +258,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param int $offset * @param int $offset
* @param int $length * @param int|null $length
*
* @return array * @return array
*/ */
public function slice(PersistentCollection $coll, $offset, $length = null) public function slice(PersistentCollection $coll, $offset, $length = null)
@ -266,7 +272,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
*
* @return boolean * @return boolean
*/ */
public function contains(PersistentCollection $coll, $element) public function contains(PersistentCollection $coll, $element)
@ -294,7 +301,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
*
* @return boolean * @return boolean
*/ */
public function removeElement(PersistentCollection $coll, $element) public function removeElement(PersistentCollection $coll, $element)
@ -323,8 +331,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
* @param boolean $addFilters Whether the filter SQL should be included or not. * @param boolean $addFilters Whether the filter SQL should be included or not.
*
* @return array * @return array
*/ */
private function getJoinTableRestrictions(PersistentCollection $coll, $element, $addFilters) private function getJoinTableRestrictions(PersistentCollection $coll, $element, $addFilters)
@ -431,8 +440,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
/** /**
* Generates the filter SQL for a given entity and table alias. * Generates the filter SQL for a given entity and table alias.
* *
* @param ClassMetadata $targetEntity Metadata of the target entity. * @param ClassMetadata $targetEntity Metadata of the target entity.
* @param string $targetTableAlias The table alias of the joined/selected table. * @param string $targetTableAlias The table alias of the joined/selected table.
* *
* @return string The SQL query part to add to a query. * @return string The SQL query part to add to a query.
*/ */

View File

@ -37,7 +37,9 @@ class OneToManyPersister extends AbstractCollectionPersister
* key to null. * key to null.
* *
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
*
* @return string * @return string
*
* @override * @override
*/ */
protected function getDeleteRowSQL(PersistentCollection $coll) protected function getDeleteRowSQL(PersistentCollection $coll)
@ -61,7 +63,8 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* {@inheritdoc} * {@inheritdoc}
* @throws \BadMethodCallException Not used for OneToManyPersister *
* @throws \BadMethodCallException Not used for OneToManyPersister.
*/ */
protected function getInsertRowSQL(PersistentCollection $coll) protected function getInsertRowSQL(PersistentCollection $coll)
{ {
@ -71,7 +74,7 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @throws \BadMethodCallException Not used for OneToManyPersister * @throws \BadMethodCallException Not used for OneToManyPersister.
*/ */
protected function getInsertRowSQLParameters(PersistentCollection $coll, $element) protected function getInsertRowSQLParameters(PersistentCollection $coll, $element)
{ {
@ -81,7 +84,7 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @throws \BadMethodCallException Not used for OneToManyPersister * @throws \BadMethodCallException Not used for OneToManyPersister.
*/ */
protected function getUpdateRowSQL(PersistentCollection $coll) protected function getUpdateRowSQL(PersistentCollection $coll)
{ {
@ -91,7 +94,7 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @throws \BadMethodCallException Not used for OneToManyPersister * @throws \BadMethodCallException Not used for OneToManyPersister.
*/ */
protected function getDeleteSQL(PersistentCollection $coll) protected function getDeleteSQL(PersistentCollection $coll)
{ {
@ -101,7 +104,7 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @throws \BadMethodCallException Not used for OneToManyPersister * @throws \BadMethodCallException Not used for OneToManyPersister.
*/ */
protected function getDeleteSQLParameters(PersistentCollection $coll) protected function getDeleteSQLParameters(PersistentCollection $coll)
{ {
@ -146,8 +149,9 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param int $offset * @param int $offset
* @param int $length * @param int|null $length
*
* @return \Doctrine\Common\Collections\ArrayCollection * @return \Doctrine\Common\Collections\ArrayCollection
*/ */
public function slice(PersistentCollection $coll, $offset, $length = null) public function slice(PersistentCollection $coll, $offset, $length = null)
@ -161,7 +165,8 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
*
* @return boolean * @return boolean
*/ */
public function contains(PersistentCollection $coll, $element) public function contains(PersistentCollection $coll, $element)
@ -193,7 +198,8 @@ class OneToManyPersister extends AbstractCollectionPersister
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
*
* @return boolean * @return boolean
*/ */
public function removeElement(PersistentCollection $coll, $element) public function removeElement(PersistentCollection $coll, $element)

View File

@ -147,6 +147,9 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL();
} }
/**
* @return string
*/
protected function getSelectConditionDiscriminatorValueSQL() protected function getSelectConditionDiscriminatorValueSQL()
{ {
$values = array(); $values = array();

View File

@ -46,7 +46,7 @@ class SqlExpressionVisitor extends ExpressionVisitor
} }
/** /**
* Convert a comparison expression into the target query language output * Converts a comparison expression into the target query language output.
* *
* @param \Doctrine\Common\Collections\Expr\Comparison $comparison * @param \Doctrine\Common\Collections\Expr\Comparison $comparison
* *
@ -61,11 +61,13 @@ class SqlExpressionVisitor extends ExpressionVisitor
} }
/** /**
* Convert a composite expression into the target query language output * Converts a composite expression into the target query language output.
* *
* @param \Doctrine\Common\Collections\Expr\CompositeExpression $expr * @param \Doctrine\Common\Collections\Expr\CompositeExpression $expr
* *
* @return mixed * @return mixed
*
* @throws \RuntimeException
*/ */
public function walkCompositeExpression(CompositeExpression $expr) public function walkCompositeExpression(CompositeExpression $expr)
{ {
@ -88,7 +90,7 @@ class SqlExpressionVisitor extends ExpressionVisitor
} }
/** /**
* Convert a value expression into the target query language part. * Converts a value expression into the target query language part.
* *
* @param \Doctrine\Common\Collections\Expr\Value $value * @param \Doctrine\Common\Collections\Expr\Value $value
* *

View File

@ -42,7 +42,7 @@ class SqlValueVisitor extends ExpressionVisitor
private $types = array(); private $types = array();
/** /**
* Convert a comparison expression into the target query language output * Converts a comparison expression into the target query language output.
* *
* @param \Doctrine\Common\Collections\Expr\Comparison $comparison * @param \Doctrine\Common\Collections\Expr\Comparison $comparison
* *
@ -58,7 +58,7 @@ class SqlValueVisitor extends ExpressionVisitor
} }
/** /**
* Convert a composite expression into the target query language output * Converts a composite expression into the target query language output.
* *
* @param \Doctrine\Common\Collections\Expr\CompositeExpression $expr * @param \Doctrine\Common\Collections\Expr\CompositeExpression $expr
* *
@ -72,7 +72,7 @@ class SqlValueVisitor extends ExpressionVisitor
} }
/** /**
* Convert a value expression into the target query language part. * Converts a value expression into the target query language part.
* *
* @param \Doctrine\Common\Collections\Expr\Value $value * @param \Doctrine\Common\Collections\Expr\Value $value
* *
@ -84,7 +84,7 @@ class SqlValueVisitor extends ExpressionVisitor
} }
/** /**
* Return the Parameters and Types necessary for matching the last visited expression. * Returns the Parameters and Types necessary for matching the last visited expression.
* *
* @return array * @return array
*/ */

View File

@ -21,5 +21,4 @@ namespace Doctrine\ORM\Persisters;
class UnionSubclassPersister extends BasicEntityPersister class UnionSubclassPersister extends BasicEntityPersister
{ {
} }

View File

@ -30,6 +30,9 @@ namespace Doctrine\ORM;
*/ */
class PessimisticLockException extends ORMException class PessimisticLockException extends ORMException
{ {
/**
* @return PessimisticLockException
*/
public static function lockFailed() public static function lockFailed()
{ {
return new self("The pessimistic lock failed."); return new self("The pessimistic lock failed.");

View File

@ -27,7 +27,7 @@ namespace Doctrine\ORM\Proxy;
class Autoloader class Autoloader
{ {
/** /**
* Resolve proxy class name to a filename based on the following pattern. * Resolves proxy class name to a filename based on the following pattern.
* *
* 1. Remove Proxy namespace from class name * 1. Remove Proxy namespace from class name
* 2. Remove namespace seperators from remaining class name. * 2. Remove namespace seperators from remaining class name.
@ -36,7 +36,10 @@ class Autoloader
* @param string $proxyDir * @param string $proxyDir
* @param string $proxyNamespace * @param string $proxyNamespace
* @param string $className * @param string $className
*
* @return string * @return string
*
* @throws ProxyException
*/ */
static public function resolveFile($proxyDir, $proxyNamespace, $className) static public function resolveFile($proxyDir, $proxyNamespace, $className)
{ {
@ -49,13 +52,14 @@ class Autoloader
} }
/** /**
* Register and return autoloader callback for the given proxy dir and * Registers and returns autoloader callback for the given proxy dir and
* namespace. * namespace.
* *
* @param string $proxyDir * @param string $proxyDir
* @param string $proxyNamespace * @param string $proxyNamespace
* @param Closure $notFoundCallback Invoked when the proxy file is not found. * @param \Closure $notFoundCallback Invoked when the proxy file is not found.
* @return Closure *
* @return \Closure
*/ */
static public function register($proxyDir, $proxyNamespace, \Closure $notFoundCallback = null) static public function register($proxyDir, $proxyNamespace, \Closure $notFoundCallback = null)
{ {
@ -75,4 +79,3 @@ class Autoloader
return $autoloader; return $autoloader;
} }
} }

View File

@ -27,4 +27,6 @@ use Doctrine\Common\Persistence\Proxy as BaseProxy;
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */
interface Proxy extends BaseProxy {} interface Proxy extends BaseProxy
{
}

View File

@ -20,27 +20,45 @@
namespace Doctrine\ORM\Proxy; namespace Doctrine\ORM\Proxy;
/** /**
* ORM Proxy Exception * ORM Proxy Exception.
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.com * @link www.doctrine-project.com
* @since 1.0 * @since 1.0
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
*/ */
class ProxyException extends \Doctrine\ORM\ORMException { class ProxyException extends \Doctrine\ORM\ORMException
{
public static function proxyDirectoryRequired() { /**
* @return ProxyException
*/
public static function proxyDirectoryRequired()
{
return new self("You must configure a proxy directory. See docs for details"); return new self("You must configure a proxy directory. See docs for details");
} }
public static function proxyDirectoryNotWritable() { /**
* @return ProxyException
*/
public static function proxyDirectoryNotWritable()
{
return new self("Your proxy directory must be writable."); return new self("Your proxy directory must be writable.");
} }
public static function proxyNamespaceRequired() { /**
* @return ProxyException
*/
public static function proxyNamespaceRequired()
{
return new self("You must configure a proxy namespace. See docs for details"); return new self("You must configure a proxy namespace. See docs for details");
} }
/**
* @param $className
* @param $proxyNamespace
*
* @return ProxyException
*/
public static function notProxyClass($className, $proxyNamespace) public static function notProxyClass($className, $proxyNamespace)
{ {
return new self(sprintf( return new self(sprintf(
@ -48,5 +66,4 @@ class ProxyException extends \Doctrine\ORM\ORMException {
$className, $proxyNamespace $className, $proxyNamespace
)); ));
} }
} }

View File

@ -32,13 +32,32 @@ use Doctrine\Common\Util\ClassUtils;
*/ */
class ProxyFactory class ProxyFactory
{ {
/** The EntityManager this factory is bound to. */ /**
* The EntityManager this factory is bound to.
*
* @var \Doctrine\ORM\EntityManager
*/
private $_em; private $_em;
/** Whether to automatically (re)generate proxy classes. */
/**
* Whether to automatically (re)generate proxy classes.
*
* @var bool
*/
private $_autoGenerate; private $_autoGenerate;
/** The namespace that contains all proxy classes. */
/**
* The namespace that contains all proxy classes.
*
* @var string
*/
private $_proxyNamespace; private $_proxyNamespace;
/** The directory that contains all proxy classes. */
/**
* The directory that contains all proxy classes.
*
* @var string
*/
private $_proxyDir; private $_proxyDir;
/** /**
@ -53,10 +72,12 @@ class ProxyFactory
* Initializes a new instance of the <tt>ProxyFactory</tt> class that is * Initializes a new instance of the <tt>ProxyFactory</tt> class that is
* connected to the given <tt>EntityManager</tt>. * connected to the given <tt>EntityManager</tt>.
* *
* @param EntityManager $em The EntityManager the new factory works for. * @param EntityManager $em The EntityManager the new factory works for.
* @param string $proxyDir The directory to use for the proxy classes. It must exist. * @param string $proxyDir The directory to use for the proxy classes. It must exist.
* @param string $proxyNs The namespace to use for the proxy classes. * @param string $proxyNs The namespace to use for the proxy classes.
* @param boolean $autoGenerate Whether to automatically generate proxy classes. * @param boolean $autoGenerate Whether to automatically generate proxy classes.
*
* @throws ProxyException
*/ */
public function __construct(EntityManager $em, $proxyDir, $proxyNs, $autoGenerate = false) public function __construct(EntityManager $em, $proxyDir, $proxyNs, $autoGenerate = false)
{ {
@ -77,7 +98,8 @@ class ProxyFactory
* the given identifier. * the given identifier.
* *
* @param string $className * @param string $className
* @param mixed $identifier * @param mixed $identifier
*
* @return object * @return object
*/ */
public function getProxy($className, $identifier) public function getProxy($className, $identifier)
@ -98,12 +120,12 @@ class ProxyFactory
} }
/** /**
* Generate the Proxy file name * Generates the Proxy file name.
* *
* @param string $className * @param string $className
* @param string $baseDir Optional base directory for proxy file name generation. * @param string|null $baseDir Optional base directory for proxy file name generation.
* If not specified, the directory configured on the Configuration of the * If not specified, the directory configured on the Configuration of the
* EntityManager will be used by this factory. * EntityManager will be used by this factory.
* @return string * @return string
*/ */
private function getProxyFileName($className, $baseDir = null) private function getProxyFileName($className, $baseDir = null)
@ -116,10 +138,11 @@ class ProxyFactory
/** /**
* Generates proxy classes for all given classes. * Generates proxy classes for all given classes.
* *
* @param array $classes The classes (ClassMetadata instances) for which to generate proxies. * @param array $classes The classes (ClassMetadata instances) for which to generate proxies.
* @param string $toDir The target directory of the proxy classes. If not specified, the * @param string|null $toDir The target directory of the proxy classes. If not specified, the
* directory configured on the Configuration of the EntityManager used * directory configured on the Configuration of the EntityManager used
* by this factory is used. * by this factory is used.
*
* @return int Number of generated proxies. * @return int Number of generated proxies.
*/ */
public function generateProxyClasses(array $classes, $toDir = null) public function generateProxyClasses(array $classes, $toDir = null)
@ -146,9 +169,13 @@ class ProxyFactory
/** /**
* Generates a proxy class file. * Generates a proxy class file.
* *
* @param ClassMetadata $class Metadata for the original class * @param ClassMetadata $class Metadata for the original class.
* @param string $fileName Filename (full path) for the generated class * @param string $fileName Filename (full path) for the generated class.
* @param string $file The proxy class template data * @param string $file The proxy class template data.
*
* @return void
*
* @throws ProxyException
*/ */
private function _generateProxyClass(ClassMetadata $class, $fileName, $file) private function _generateProxyClass(ClassMetadata $class, $fileName, $file)
{ {
@ -198,6 +225,7 @@ class ProxyFactory
* Generates the methods of a proxy class. * Generates the methods of a proxy class.
* *
* @param ClassMetadata $class * @param ClassMetadata $class
*
* @return string The code of the generated methods. * @return string The code of the generated methods.
*/ */
private function _generateMethods(ClassMetadata $class) private function _generateMethods(ClassMetadata $class)
@ -206,7 +234,7 @@ class ProxyFactory
$methodNames = array(); $methodNames = array();
foreach ($class->reflClass->getMethods() as $method) { foreach ($class->reflClass->getMethods() as $method) {
/* @var $method ReflectionMethod */ /* @var $method \ReflectionMethod */
if ($method->isConstructor() || in_array(strtolower($method->getName()), array("__sleep", "__clone")) || isset($methodNames[$method->getName()])) { if ($method->isConstructor() || in_array(strtolower($method->getName()), array("__sleep", "__clone")) || isset($methodNames[$method->getName()])) {
continue; continue;
} }
@ -269,7 +297,7 @@ class ProxyFactory
} }
/** /**
* Check if the method is a short identifier getter. * Checks if the method is a short identifier getter.
* *
* What does this mean? For proxy objects the identifier is already known, * What does this mean? For proxy objects the identifier is already known,
* however accessing the getter for this identifier usually triggers the * however accessing the getter for this identifier usually triggers the
@ -277,8 +305,9 @@ class ProxyFactory
* ID is interesting for the userland code (for example in views that * ID is interesting for the userland code (for example in views that
* generate links to the entity, but do not display anything else). * generate links to the entity, but do not display anything else).
* *
* @param ReflectionMethod $method * @param \ReflectionMethod $method
* @param ClassMetadata $class * @param ClassMetadata $class
*
* @return bool * @return bool
*/ */
private function isShortIdentifierGetter($method, ClassMetadata $class) private function isShortIdentifierGetter($method, ClassMetadata $class)
@ -309,7 +338,8 @@ class ProxyFactory
/** /**
* Generates the code for the __sleep method for a proxy class. * Generates the code for the __sleep method for a proxy class.
* *
* @param $class * @param ClassMetadata $class
*
* @return string * @return string
*/ */
private function _generateSleep(ClassMetadata $class) private function _generateSleep(ClassMetadata $class)

View File

@ -41,6 +41,7 @@ final class Query extends AbstractQuery
* A query object is in CLEAN state when it has NO unparsed/unprocessed DQL parts. * A query object is in CLEAN state when it has NO unparsed/unprocessed DQL parts.
*/ */
const STATE_CLEAN = 1; const STATE_CLEAN = 1;
/** /**
* A query object is in state DIRTY when it has DQL parts that have not yet been * A query object is in state DIRTY when it has DQL parts that have not yet been
* parsed/processed. This is automatically defined as DIRTY when addDqlQueryPart * parsed/processed. This is automatically defined as DIRTY when addDqlQueryPart
@ -49,6 +50,7 @@ final class Query extends AbstractQuery
const STATE_DIRTY = 2; const STATE_DIRTY = 2;
/* Query HINTS */ /* Query HINTS */
/** /**
* The refresh hint turns any query into a refresh query with the result that * The refresh hint turns any query into a refresh query with the result that
* any local changes in entities are overridden with the fetched values. * any local changes in entities are overridden with the fetched values.
@ -57,7 +59,6 @@ final class Query extends AbstractQuery
*/ */
const HINT_REFRESH = 'doctrine.refresh'; const HINT_REFRESH = 'doctrine.refresh';
/** /**
* Internal hint: is set to the proxy entity that is currently triggered for loading * Internal hint: is set to the proxy entity that is currently triggered for loading
* *
@ -73,6 +74,7 @@ final class Query extends AbstractQuery
* @todo Rename: HINT_OPTIMIZE * @todo Rename: HINT_OPTIMIZE
*/ */
const HINT_FORCE_PARTIAL_LOAD = 'doctrine.forcePartialLoad'; const HINT_FORCE_PARTIAL_LOAD = 'doctrine.forcePartialLoad';
/** /**
* The includeMetaColumns query hint causes meta columns like foreign keys and * The includeMetaColumns query hint causes meta columns like foreign keys and
* discriminator columns to be selected and returned as part of the query result. * discriminator columns to be selected and returned as part of the query result.
@ -111,49 +113,66 @@ final class Query extends AbstractQuery
*/ */
const HINT_LOCK_MODE = 'doctrine.lockMode'; const HINT_LOCK_MODE = 'doctrine.lockMode';
/** /**
* @var integer $_state The current state of this query. * The current state of this query.
*
* @var integer
*/ */
private $_state = self::STATE_CLEAN; private $_state = self::STATE_CLEAN;
/** /**
* @var string $_dql Cached DQL query. * Cached DQL query.
*
* @var string
*/ */
private $_dql = null; private $_dql = null;
/** /**
* @var \Doctrine\ORM\Query\ParserResult The parser result that holds DQL => SQL information. * The parser result that holds DQL => SQL information.
*
* @var \Doctrine\ORM\Query\ParserResult
*/ */
private $_parserResult; private $_parserResult;
/** /**
* @var integer The first result to return (the "offset"). * The first result to return (the "offset").
*
* @var integer
*/ */
private $_firstResult = null; private $_firstResult = null;
/** /**
* @var integer The maximum number of results to return (the "limit"). * The maximum number of results to return (the "limit").
*
* @var integer
*/ */
private $_maxResults = null; private $_maxResults = null;
/** /**
* @var CacheDriver The cache driver used for caching queries. * The cache driver used for caching queries.
*
* @var \Doctrine\Common\Cache\Cache|null
*/ */
private $_queryCache; private $_queryCache;
/** /**
* @var boolean Boolean value that indicates whether or not expire the query cache. * Whether or not expire the query cache.
*
* @var boolean
*/ */
private $_expireQueryCache = false; private $_expireQueryCache = false;
/** /**
* @var int Query Cache lifetime. * The query cache lifetime.
*
* @var int
*/ */
private $_queryCacheTTL; private $_queryCacheTTL;
/** /**
* @var boolean Whether to use a query cache, if available. Defaults to TRUE. * Whether to use a query cache, if available. Defaults to TRUE.
*
* @var boolean
*/ */
private $_useQueryCache = true; private $_useQueryCache = true;
@ -171,6 +190,7 @@ final class Query extends AbstractQuery
* Gets the SQL query/queries that correspond to this DQL query. * Gets the SQL query/queries that correspond to this DQL query.
* *
* @return mixed The built sql query or an array of all sql queries. * @return mixed The built sql query or an array of all sql queries.
*
* @override * @override
*/ */
public function getSQL() public function getSQL()
@ -265,10 +285,13 @@ final class Query extends AbstractQuery
} }
/** /**
* Processes query parameter mappings * Processes query parameter mappings.
* *
* @param array $paramMappings * @param array $paramMappings
*
* @return array * @return array
*
* @throws Query\QueryException
*/ */
private function processParameterMappings($paramMappings) private function processParameterMappings($paramMappings)
{ {
@ -321,7 +344,8 @@ final class Query extends AbstractQuery
/** /**
* Defines a cache driver to be used for caching queries. * Defines a cache driver to be used for caching queries.
* *
* @param Doctrine_Cache_Interface|null $driver Cache driver * @param \Doctrine\Common\Cache\Cache|null $queryCache Cache driver.
*
* @return Query This query instance. * @return Query This query instance.
*/ */
public function setQueryCacheDriver($queryCache) public function setQueryCacheDriver($queryCache)
@ -335,7 +359,8 @@ final class Query extends AbstractQuery
* Defines whether the query should make use of a query cache, if available. * Defines whether the query should make use of a query cache, if available.
* *
* @param boolean $bool * @param boolean $bool
* @return @return Query This query instance. *
* @return Query This query instance.
*/ */
public function useQueryCache($bool) public function useQueryCache($bool)
{ {
@ -347,8 +372,8 @@ final class Query extends AbstractQuery
/** /**
* Returns the cache driver used for query caching. * Returns the cache driver used for query caching.
* *
* @return CacheDriver The cache driver used for query caching or NULL, if * @return \Doctrine\Common\Cache\Cache|null The cache driver used for query caching or NULL, if
* this Query does not use query caching. * this Query does not use query caching.
*/ */
public function getQueryCacheDriver() public function getQueryCacheDriver()
{ {
@ -362,7 +387,8 @@ final class Query extends AbstractQuery
/** /**
* Defines how long the query cache will be active before expire. * Defines how long the query cache will be active before expire.
* *
* @param integer $timeToLive How long the cache entry is valid * @param integer $timeToLive How long the cache entry is valid.
*
* @return Query This query instance. * @return Query This query instance.
*/ */
public function setQueryCacheLifetime($timeToLive) public function setQueryCacheLifetime($timeToLive)
@ -390,6 +416,7 @@ final class Query extends AbstractQuery
* Defines if the query cache is active or not. * Defines if the query cache is active or not.
* *
* @param boolean $expire Whether or not to force query cache expiration. * @param boolean $expire Whether or not to force query cache expiration.
*
* @return Query This query instance. * @return Query This query instance.
*/ */
public function expireQueryCache($expire = true) public function expireQueryCache($expire = true)
@ -423,7 +450,8 @@ final class Query extends AbstractQuery
/** /**
* Sets a DQL query string. * Sets a DQL query string.
* *
* @param string $dqlQuery DQL Query * @param string $dqlQuery DQL Query.
*
* @return \Doctrine\ORM\AbstractQuery * @return \Doctrine\ORM\AbstractQuery
*/ */
public function setDQL($dqlQuery) public function setDQL($dqlQuery)
@ -439,7 +467,7 @@ final class Query extends AbstractQuery
/** /**
* Returns the DQL query that is represented by this query object. * Returns the DQL query that is represented by this query object.
* *
* @return string DQL query * @return string DQL query.
*/ */
public function getDQL() public function getDQL()
{ {
@ -454,7 +482,7 @@ final class Query extends AbstractQuery
* @see AbstractQuery::STATE_CLEAN * @see AbstractQuery::STATE_CLEAN
* @see AbstractQuery::STATE_DIRTY * @see AbstractQuery::STATE_DIRTY
* *
* @return integer Return the query state * @return integer The query state.
*/ */
public function getState() public function getState()
{ {
@ -464,7 +492,8 @@ final class Query extends AbstractQuery
/** /**
* Method to check if an arbitrary piece of DQL exists * Method to check if an arbitrary piece of DQL exists
* *
* @param string $dql Arbitrary piece of DQL to check for * @param string $dql Arbitrary piece of DQL to check for.
*
* @return boolean * @return boolean
*/ */
public function contains($dql) public function contains($dql)
@ -476,6 +505,7 @@ final class Query extends AbstractQuery
* Sets the position of the first result to retrieve (the "offset"). * Sets the position of the first result to retrieve (the "offset").
* *
* @param integer $firstResult The first result to return. * @param integer $firstResult The first result to return.
*
* @return Query This query object. * @return Query This query object.
*/ */
public function setFirstResult($firstResult) public function setFirstResult($firstResult)
@ -501,6 +531,7 @@ final class Query extends AbstractQuery
* Sets the maximum number of results to retrieve (the "limit"). * Sets the maximum number of results to retrieve (the "limit").
* *
* @param integer $maxResults * @param integer $maxResults
*
* @return Query This query object. * @return Query This query object.
*/ */
public function setMaxResults($maxResults) public function setMaxResults($maxResults)
@ -526,8 +557,9 @@ final class Query extends AbstractQuery
* Executes the query and returns an IterableResult that can be used to incrementally * Executes the query and returns an IterableResult that can be used to incrementally
* iterated over the result. * iterated over the result.
* *
* @param \Doctrine\Common\Collections\ArrayCollection|array $parameters The query parameters. * @param ArrayCollection|array|null $parameters The query parameters.
* @param integer $hydrationMode The hydration mode to use. * @param integer $hydrationMode The hydration mode to use.
*
* @return \Doctrine\ORM\Internal\Hydration\IterableResult * @return \Doctrine\ORM\Internal\Hydration\IterableResult
*/ */
public function iterate($parameters = null, $hydrationMode = self::HYDRATE_OBJECT) public function iterate($parameters = null, $hydrationMode = self::HYDRATE_OBJECT)
@ -561,8 +593,12 @@ final class Query extends AbstractQuery
* Set the lock mode for this Query. * Set the lock mode for this Query.
* *
* @see \Doctrine\DBAL\LockMode * @see \Doctrine\DBAL\LockMode
*
* @param int $lockMode * @param int $lockMode
*
* @return Query * @return Query
*
* @throws TransactionRequiredException
*/ */
public function setLockMode($lockMode) public function setLockMode($lockMode)
{ {

View File

@ -26,6 +26,11 @@ use Doctrine\ORM\Query\QueryException;
*/ */
class ASTException extends QueryException class ASTException extends QueryException
{ {
/**
* @param Node $node
*
* @return ASTException
*/
public static function noDispatchForNode($node) public static function noDispatchForNode($node)
{ {
return new self("Double-dispatch for node " . get_class($node) . " is not supported."); return new self("Double-dispatch for node " . get_class($node) . " is not supported.");

Some files were not shown because too many files have changed in this diff Show More