1
0
mirror of synced 2025-01-22 08:11:40 +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
{
/* Hydration mode constants */
/**
* Hydrates an object graph. This is the default behavior.
*/
const HYDRATE_OBJECT = 1;
/**
* Hydrates an array graph.
*/
const HYDRATE_ARRAY = 2;
/**
* Hydrates a flat, rectangular result set with scalar values.
*/
const HYDRATE_SCALAR = 3;
/**
* Hydrates a single scalar value.
*/
@ -65,27 +69,37 @@ abstract class AbstractQuery
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;
/**
* @var \Doctrine\ORM\Query\ResultSetMapping The user-specified ResultSetMapping to use.
* The user-specified ResultSetMapping to use.
*
* @var \Doctrine\ORM\Query\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;
/**
* @var array The map of query hints.
* The map of query hints.
*
* @var array
*/
protected $_hints = array();
/**
* @var integer The hydration mode.
* The hydration mode.
*
* @var integer
*/
protected $_hydrationMode = self::HYDRATE_OBJECT;
@ -95,7 +109,9 @@ abstract class AbstractQuery
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;
@ -107,7 +123,7 @@ abstract class AbstractQuery
/**
* 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)
{
@ -208,9 +224,9 @@ abstract class AbstractQuery
/**
* 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 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
* strings and numeric types.
*
@ -241,10 +257,13 @@ abstract class AbstractQuery
}
/**
* Process an individual parameter value
* Processes an individual parameter value.
*
* @param mixed $value
*
* @return array
*
* @throws ORMInvalidArgumentException
*/
public function processParameterValue($value)
{
@ -272,6 +291,7 @@ abstract class AbstractQuery
* Sets the ResultSetMapping that should be used for hydration.
*
* @param \Doctrine\ORM\Query\ResultSetMapping $rsm
*
* @return \Doctrine\ORM\AbstractQuery
*/
public function setResultSetMapping(Query\ResultSetMapping $rsm)
@ -300,6 +320,7 @@ abstract class AbstractQuery
* $query->setHydrationCacheProfile(new QueryCacheProfile($lifetime, $resultKey));
*
* @param \Doctrine\DBAL\Cache\QueryCacheProfile $profile
*
* @return \Doctrine\ORM\AbstractQuery
*/
public function setHydrationCacheProfile(QueryCacheProfile $profile = null)
@ -329,6 +350,7 @@ abstract class AbstractQuery
* result cache driver is used from the configuration.
*
* @param \Doctrine\DBAL\Cache\QueryCacheProfile $profile
*
* @return \Doctrine\ORM\AbstractQuery
*/
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.
*
* @param \Doctrine\Common\Cache\Cache $driver Cache driver
* @param \Doctrine\Common\Cache\Cache|null $resultCacheDriver Cache driver
*
* @return \Doctrine\ORM\AbstractQuery
*
* @throws ORMException
*/
public function setResultCacheDriver($resultCacheDriver = null)
{
@ -366,6 +391,7 @@ abstract class AbstractQuery
* Returns the cache driver used for caching result sets.
*
* @deprecated
*
* @return \Doctrine\Common\Cache\Cache Cache driver
*/
public function getResultCacheDriver()
@ -384,6 +410,7 @@ abstract class AbstractQuery
* @param boolean $bool
* @param integer $lifetime
* @param string $resultCacheId
*
* @return \Doctrine\ORM\AbstractQuery This query instance.
*/
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.
*
* @param integer $lifetime How long the cache entry is valid.
*
* @return \Doctrine\ORM\AbstractQuery This query instance.
*/
public function setResultCacheLifetime($lifetime)
@ -421,6 +449,7 @@ abstract class AbstractQuery
* Retrieves the lifetime of resultset cache.
*
* @deprecated
*
* @return integer
*/
public function getResultCacheLifetime()
@ -432,6 +461,7 @@ abstract class AbstractQuery
* Defines if the result cache is active or not.
*
* @param boolean $expire Whether or not to force resultset cache expiration.
*
* @return \Doctrine\ORM\AbstractQuery This query instance.
*/
public function expireResultCache($expire = true)
@ -467,6 +497,7 @@ abstract class AbstractQuery
* @param string $class
* @param string $assocName
* @param int $fetchMode
*
* @return AbstractQuery
*/
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.
* One of the Query::HYDRATE_* constants.
*
* @return \Doctrine\ORM\AbstractQuery This query instance.
*/
public function setHydrationMode($hydrationMode)
@ -509,6 +541,8 @@ abstract class AbstractQuery
*
* Alias for execute(null, $hydrationMode = HYDRATE_OBJECT).
*
* @param int $hydrationMode
*
* @return array
*/
public function getResult($hydrationMode = self::HYDRATE_OBJECT)
@ -543,9 +577,11 @@ abstract class AbstractQuery
/**
* Get exactly one result or null.
*
* @throws NonUniqueResultException
* @param int $hydrationMode
*
* @return mixed
*
* @throws NonUniqueResultException
*/
public function getOneOrNullResult($hydrationMode = null)
{
@ -575,7 +611,9 @@ abstract class AbstractQuery
* If there is no result, a NoResultException is thrown.
*
* @param integer $hydrationMode
*
* @return mixed
*
* @throws NonUniqueResultException If the query result is not unique.
* @throws NoResultException If the query returned no result.
*/
@ -604,6 +642,7 @@ abstract class AbstractQuery
* Alias for getSingleResult(HYDRATE_SINGLE_SCALAR).
*
* @return mixed
*
* @throws QueryException If the query result is not unique.
*/
public function getSingleScalarResult()
@ -616,6 +655,7 @@ abstract class AbstractQuery
*
* @param string $name The name of the hint.
* @param mixed $value The value of the hint.
*
* @return \Doctrine\ORM\AbstractQuery
*/
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.
*
* @param string $name The name of the hint.
*
* @return mixed The value of the hint or FALSE, if the hint name is not recognized.
*/
public function getHint($name)
@ -650,8 +691,9 @@ abstract class AbstractQuery
* Executes the query and returns an IterableResult that can be used to incrementally
* iterate over the result.
*
* @param \Doctrine\Common\Collections\ArrayCollection|array $parameters The query parameters.
* @param integer $hydrationMode The hydration mode to use.
* @param ArrayCollection|array|null $parameters The query parameters.
* @param integer|null $hydrationMode The hydration mode to use.
*
* @return \Doctrine\ORM\Internal\Hydration\IterableResult
*/
public function iterate($parameters = null, $hydrationMode = null)
@ -674,8 +716,9 @@ abstract class AbstractQuery
/**
* Executes the query.
*
* @param \Doctrine\Common\Collections\ArrayCollection|array $parameters Query parameters.
* @param integer $hydrationMode Processing mode to be used during the hydration process.
* @param ArrayCollection|array|null $parameters Query parameters.
* @param integer|null $hydrationMode Processing mode to be used during the hydration process.
*
* @return mixed
*/
public function execute($parameters = null, $hydrationMode = null)
@ -760,6 +803,7 @@ abstract class AbstractQuery
* generated for you.
*
* @param string $id
*
* @return \Doctrine\ORM\AbstractQuery This query instance.
*/
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.
*
* @deprecated
*
* @return string
*/
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.
*
* @param string $dir
*
* @return void
*/
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.
*
* @return string
* @return string|null
*/
public function getProxyDir()
{
@ -85,6 +87,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* during each script execution.
*
* @param boolean $bool
*
* @return void
*/
public function setAutoGenerateProxyClasses($bool)
{
@ -94,7 +98,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/**
* Gets the namespace where proxy classes reside.
*
* @return string
* @return string|null
*/
public function getProxyNamespace()
{
@ -107,6 +111,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the namespace where proxy classes reside.
*
* @param string $ns
*
* @return void
*/
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.
*
* @param MappingDriver $driverImpl
*
* @return void
*
* @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).
*/
@ -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.
*
* @param array $paths
* @param bool $useSimpleAnnotationReader
*
* @return AnnotationDriver
*/
public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = true)
@ -157,6 +167,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $alias
* @param string $namespace
*
* @return void
*/
public function addEntityNamespace($alias, $namespace)
{
@ -167,8 +179,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Resolves a registered namespace alias to the full namespace.
*
* @param string $entityNamespaceAlias
* @throws ORMException
*
* @return string
*
* @throws ORMException
*/
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
*
* @return void
*/
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.
*
* @return MappingDriver|null
*
* @throws ORMException
* @return MappingDriver
*/
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).
*
* @return \Doctrine\Common\Cache\Cache
* @return \Doctrine\Common\Cache\Cache|null
*/
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).
*
* @param \Doctrine\Common\Cache\Cache $cacheImpl
*
* @return void
*/
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).
*
* @return \Doctrine\Common\Cache\Cache
* @return \Doctrine\Common\Cache\Cache|null
*/
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).
*
* @param \Doctrine\Common\Cache\Cache $cacheImpl
*
* @return void
*/
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.
*
* @return \Doctrine\Common\Cache\Cache
* @return \Doctrine\Common\Cache\Cache|null
*/
public function getMetadataCacheImpl()
{
@ -272,6 +293,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Sets the cache driver implementation that is used for metadata caching.
*
* @param \Doctrine\Common\Cache\Cache $cacheImpl
*
* @return void
*/
public function setMetadataCacheImpl(Cache $cacheImpl)
{
@ -283,6 +306,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name The name of the query.
* @param string $dql The DQL query string.
*
* @return void
*/
public function addNamedQuery($name, $dql)
{
@ -293,8 +318,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Gets a previously registered named DQL query.
*
* @param string $name The name of the query.
* @throws ORMException
*
* @return string The DQL query.
*
* @throws ORMException
*/
public function getNamedQuery($name)
{
@ -311,6 +338,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* @param string $name The name of the query.
* @param string $sql The native SQL query string.
* @param Query\ResultSetMapping $rsm The ResultSetMapping used for the results of the SQL query.
*
* @return void
*/
public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm)
{
@ -321,9 +350,11 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Gets the components of a previously registered named native query.
*
* @param string $name The name of the query.
* @throws ORMException
*
* @return array A tuple with the first element being the SQL string and the second
* element being the ResultSetMapping.
*
* @throws ORMException
*/
public function getNamedNativeQuery($name)
{
@ -338,6 +369,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Ensures that this Configuration instance contains settings that are
* suitable for a production environment.
*
* @return void
*
* @throws ORMException If a configuration setting has a value that is not
* suitable for a production environment.
*/
@ -365,6 +398,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
* @param string $className
*
* @return void
*
* @throws ORMException
*/
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.
*
* @param string $name
* @return string
*
* @return string|null
*/
public function getCustomStringFunction($name)
{
@ -400,6 +437,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Any previously added string functions are discarded.
*
* @param array $functions The map of custom DQL string functions.
*
* @return void
*/
public function setCustomStringFunctions(array $functions)
{
@ -417,6 +456,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
* @param string $className
*
* @return void
*
* @throws ORMException
*/
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.
*
* @param string $name
* @return string
*
* @return string|null
*/
public function getCustomNumericFunction($name)
{
@ -452,6 +495,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Any previously added numeric functions are discarded.
*
* @param array $functions The map of custom DQL numeric functions.
*
* @return void
*/
public function setCustomNumericFunctions(array $functions)
{
@ -469,6 +514,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @param string $name
* @param string $className
*
* @return void
*
* @throws ORMException
*/
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.
*
* @param string $name
* @return string
*
* @return string|null
*/
public function getCustomDatetimeFunction($name)
{
@ -504,6 +553,8 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Any previously added date/time functions are discarded.
*
* @param array $functions The map of custom DQL date/time functions.
*
* @return void
*/
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)
{
@ -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.
* @return string $hydrator The hydrator class name.
*
* @return string|null The hydrator class name.
*/
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 $hydrator The hydrator class name.
*
* @return void
*/
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
*
* @return void
*/
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|Query\Filter\SQLFilter $filter The filter class name or an
* SQLFilter instance.
* @param string|Query\Filter\SQLFilter $filter The filter class name or an SQLFilter instance.
*
* @return void
*
* @throws \InvalidArgumentException If the filter is an object and it doesn't
* extend the Query\Filter\SQLFilter class.
@ -599,7 +658,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @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.
*/
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
*
* @param string $className
*
* @return void
*
* @throws ORMException If not is a \Doctrine\Common\Persistence\ObjectRepository
*/
public function setDefaultRepositoryClassName($className)
@ -631,6 +694,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
* Get default repository class.
*
* @since 2.2
*
* @return string
*/
public function getDefaultRepositoryClassName()
@ -641,10 +705,13 @@ class Configuration extends \Doctrine\DBAL\Configuration
}
/**
* Set naming strategy.
* Sets naming strategy.
*
* @since 2.3
*
* @param NamingStrategy $namingStrategy
*
* @return void
*/
public function setNamingStrategy(NamingStrategy $namingStrategy)
{
@ -652,9 +719,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
}
/**
* Get naming strategy..
* Gets naming strategy..
*
* @since 2.3
*
* @return NamingStrategy
*/
public function getNamingStrategy()
@ -667,10 +735,13 @@ class Configuration extends \Doctrine\DBAL\Configuration
}
/**
* Set quote strategy.
* Sets quote strategy.
*
* @since 2.3
*
* @param \Doctrine\ORM\Mapping\QuoteStrategy $quoteStrategy
*
* @return void
*/
public function setQuoteStrategy(QuoteStrategy $quoteStrategy)
{
@ -678,9 +749,10 @@ class Configuration extends \Doctrine\DBAL\Configuration
}
/**
* Get quote strategy.
* Gets quote strategy.
*
* @since 2.3
*
* @return \Doctrine\ORM\Mapping\QuoteStrategy
*/
public function getQuoteStrategy()

View File

@ -193,6 +193,8 @@ class EntityManager implements ObjectManager
/**
* Starts a transaction on the underlying database connection.
*
* @return void
*/
public function beginTransaction()
{
@ -210,7 +212,8 @@ class EntityManager implements ObjectManager
* the transaction is rolled back, the EntityManager closed and the exception re-thrown.
*
* @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)
{
@ -237,6 +240,8 @@ class EntityManager implements ObjectManager
/**
* Commits a transaction on the underlying database connection.
*
* @return void
*/
public function commit()
{
@ -245,6 +250,8 @@ class EntityManager implements ObjectManager
/**
* Performs a rollback on the underlying database connection.
*
* @return void
*/
public function rollback()
{
@ -261,7 +268,10 @@ class EntityManager implements ObjectManager
* MyProject\Domain\User
* sales:PriceRequest
*
* @param string $className
*
* @return \Doctrine\ORM\Mapping\ClassMetadata
*
* @internal Performance-sensitive method.
*/
public function getClassMetadata($className)
@ -273,6 +283,7 @@ class EntityManager implements ObjectManager
* Creates a new Query object.
*
* @param string $dql The DQL string.
*
* @return \Doctrine\ORM\Query
*/
public function createQuery($dql = "")
@ -290,6 +301,7 @@ class EntityManager implements ObjectManager
* Creates a Query from a named query.
*
* @param string $name
*
* @return \Doctrine\ORM\Query
*/
public function createNamedQuery($name)
@ -302,6 +314,7 @@ class EntityManager implements ObjectManager
*
* @param string $sql
* @param ResultSetMapping $rsm The ResultSetMapping to use.
*
* @return NativeQuery
*/
public function createNativeQuery($sql, ResultSetMapping $rsm)
@ -318,6 +331,7 @@ class EntityManager implements ObjectManager
* Creates a NativeQuery from a named native query.
*
* @param string $name
*
* @return \Doctrine\ORM\NativeQuery
*/
public function createNamedNativeQuery($name)
@ -330,7 +344,7 @@ class EntityManager implements ObjectManager
/**
* Create a QueryBuilder instance
*
* @return QueryBuilder $qb
* @return QueryBuilder
*/
public function createQueryBuilder()
{
@ -346,6 +360,9 @@ class EntityManager implements ObjectManager
* the cascade-persist semantics + scheduled inserts/removals are synchronized.
*
* @param object $entity
*
* @return void
*
* @throws \Doctrine\ORM\OptimisticLockException If a version check on an entity that
* makes use of optimistic locking fails.
*/
@ -365,6 +382,11 @@ class EntityManager implements ObjectManager
* @param integer $lockVersion
*
* @return object
*
* @throws OptimisticLockException
* @throws ORMInvalidArgumentException
* @throws TransactionRequiredException
* @throws ORMException
*/
public function find($entityName, $id, $lockMode = LockMode::NONE, $lockVersion = null)
{
@ -447,7 +469,10 @@ class EntityManager implements ObjectManager
*
* @param string $entityName The name of the entity type.
* @param mixed $id The entity identifier.
*
* @return object The entity reference.
*
* @throws ORMException
*/
public function getReference($entityName, $id)
{
@ -504,6 +529,7 @@ class EntityManager implements ObjectManager
*
* @param string $entityName The name of the entity type.
* @param mixed $identifier The entity identifier.
*
* @return object The (partial) entity reference.
*/
public function getPartialReference($entityName, $identifier)
@ -533,7 +559,9 @@ class EntityManager implements ObjectManager
* Clears the EntityManager. All entities that are currently managed
* 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)
{
@ -544,6 +572,8 @@ class EntityManager implements ObjectManager
* Closes the EntityManager. All entities that are currently managed
* by this EntityManager become detached. The EntityManager may no longer
* be used after it is closed.
*
* @return void
*/
public function close()
{
@ -561,7 +591,11 @@ class EntityManager implements ObjectManager
* 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.
*
* @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)
{
@ -581,6 +615,10 @@ class EntityManager implements ObjectManager
* or as a result of the flush operation.
*
* @param object $entity The entity instance to remove.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/
public function remove($entity)
{
@ -598,6 +636,10 @@ class EntityManager implements ObjectManager
* overriding any local changes that have not yet been persisted.
*
* @param object $entity The entity to refresh.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/
public function refresh($entity)
{
@ -618,6 +660,10 @@ class EntityManager implements ObjectManager
* reference it.
*
* @param object $entity The entity to detach.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/
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.
*
* @param object $entity The detached entity to merge into the persistence context.
*
* @return object The managed copy of the entity.
*
* @throws ORMInvalidArgumentException
*/
public function merge($entity)
{
@ -651,7 +700,12 @@ class EntityManager implements ObjectManager
* Creates a copy of the given entity. Can create a shallow or a deep copy.
*
* @param object $entity The entity to copy.
* @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:
* Fatal error: Maximum function nesting level of '100' reached, aborting!
*/
@ -665,7 +719,10 @@ class EntityManager implements ObjectManager
*
* @param object $entity
* @param int $lockMode
* @param int $lockVersion
* @param int|null $lockVersion
*
* @return void
*
* @throws OptimisticLockException
* @throws PessimisticLockException
*/
@ -678,6 +735,7 @@ class EntityManager implements ObjectManager
* Gets the repository for an entity class.
*
* @param string $entityName The name of the entity.
*
* @return EntityRepository The repository class.
*/
public function getRepository($entityName)
@ -706,6 +764,7 @@ class EntityManager implements ObjectManager
* Determines whether an entity instance is managed in this EntityManager.
*
* @param object $entity
*
* @return boolean TRUE if this EntityManager currently manages the given entity, FALSE otherwise.
*/
public function contains($entity)
@ -738,6 +797,8 @@ class EntityManager implements ObjectManager
/**
* Throws an exception if the EntityManager is closed or currently not active.
*
* @return void
*
* @throws ORMException If the EntityManager is closed.
*/
private function errorIfClosed()
@ -774,6 +835,7 @@ class EntityManager implements ObjectManager
* selectively iterate over the result.
*
* @param int $hydrationMode
*
* @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
*/
public function getHydrator($hydrationMode)
@ -789,7 +851,10 @@ class EntityManager implements ObjectManager
* Create a new instance for the given hydration mode.
*
* @param int $hydrationMode
*
* @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator
*
* @throws ORMException
*/
public function newHydrator($hydrationMode)
{
@ -834,6 +899,8 @@ class EntityManager implements ObjectManager
* This method is a no-op for other objects
*
* @param object $obj
*
* @return void
*/
public function initializeObject($obj)
{
@ -843,11 +910,14 @@ class EntityManager implements ObjectManager
/**
* Factory method to create EntityManager instances.
*
* @param mixed $conn An array with the connection parameters or an existing
* Connection instance.
* @param mixed $conn An array with the connection parameters or an existing Connection instance.
* @param Configuration $config The Configuration instance to use.
* @param EventManager $eventManager The EventManager instance to use.
*
* @return EntityManager The created EntityManager.
*
* @throws \InvalidArgumentException
* @throws ORMException
*/
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.
*
* @return True, if the EM has a filter collection.
* @return boolean True, if the EM has a filter collection.
*/
public function hasFilters()
{

View File

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

View File

@ -62,7 +62,7 @@ class EntityRepository implements ObjectRepository, Selectable
* Initializes a new <tt>EntityRepository</tt>.
*
* @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)
{
@ -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
* @return QueryBuilder $qb
*
* @return QueryBuilder
*/
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".
*
* @param string $alias
*
* @return ResultSetMappingBuilder
*/
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
*
* @return Query
*/
public function createNamedQuery($queryName)
@ -115,6 +118,7 @@ class EntityRepository implements ObjectRepository, Selectable
* Creates a native SQL query.
*
* @param string $queryName
*
* @return NativeQuery
*/
public function createNativeNamedQuery($queryName)
@ -128,6 +132,8 @@ class EntityRepository implements ObjectRepository, Selectable
/**
* Clears the repository, causing all managed entities to become detached.
*
* @return void
*/
public function clear()
{
@ -138,8 +144,8 @@ class EntityRepository implements ObjectRepository, Selectable
* Finds an entity by its primary key / identifier.
*
* @param mixed $id The identifier.
* @param integer $lockMode
* @param integer $lockVersion
* @param int $lockMode The lock mode.
* @param int|null $lockVersion The lock version.
*
* @return object The entity.
*/
@ -165,6 +171,7 @@ class EntityRepository implements ObjectRepository, Selectable
* @param array|null $orderBy
* @param int|null $limit
* @param int|null $offset
*
* @return array The objects.
*/
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|null $orderBy
*
* @return object
*/
public function findOneBy(array $criteria, array $orderBy = null)
@ -191,8 +199,13 @@ class EntityRepository implements ObjectRepository, Selectable
/**
* Adds support for magic finders.
*
* @param string $method
* @param array $arguments
*
* @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
* method call.
*/
@ -291,4 +304,3 @@ class EntityRepository implements ObjectRepository, Selectable
return new ArrayCollection($persister->loadCriteria($criteria));
}
}

View File

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

View File

@ -44,8 +44,8 @@ class LoadClassMetadataEventArgs extends EventArgs
/**
* Constructor.
*
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata
* @param \Doctrine\ORM\EntityManager $em
* @param ClassMetadataInfo $classMetadata
* @param 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
*/
@ -64,7 +64,7 @@ class LoadClassMetadataEventArgs extends EventArgs
}
/**
* Retrieve associated EntityManager.
* Retrieves associated EntityManager.
*
* @return \Doctrine\ORM\EntityManager
*/
@ -73,4 +73,3 @@ class LoadClassMetadataEventArgs extends EventArgs
return $this->em;
}
}

View File

@ -44,7 +44,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
* Constructor.
*
* @param \Doctrine\ORM\EntityManager $em
* @param string $entityClass Optional entity class
* @param string|null $entityClass Optional entity class.
*/
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
*/
@ -65,7 +65,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
/**
* Name of the entity class that is cleared, or empty if all are cleared.
*
* @return string
* @return string|null
*/
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
*/

View File

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

View File

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

View File

@ -41,7 +41,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs
* Constructor.
*
* @param object $entity
* @param \Doctrine\ORM\EntityManager $em
* @param EntityManager $em
* @param 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
*/
@ -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
*/
@ -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
*
* @return mixed
*/
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
*
* @return mixed
*/
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 mixed $value
*
* @return void
*/
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
*
* @return void
*
* @throws \InvalidArgumentException
*/
private function assertValidField($field)
{
@ -126,4 +136,3 @@ class PreUpdateEventArgs extends LifecycleEventArgs
}
}
}

View File

@ -29,7 +29,13 @@ namespace Doctrine\ORM;
*/
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
* EntityManager remove operation for that entity is executed.
@ -39,6 +45,7 @@ final class Events
* @var string
*/
const preRemove = 'preRemove';
/**
* The postRemove event occurs for an entity after the entity has
* been deleted. It will be invoked after the database delete operations.
@ -48,6 +55,7 @@ final class Events
* @var string
*/
const postRemove = 'postRemove';
/**
* The prePersist event occurs for a given entity before the respective
* EntityManager persist operation for that entity is executed.
@ -57,6 +65,7 @@ final class Events
* @var string
*/
const prePersist = 'prePersist';
/**
* The postPersist event occurs for an entity after the entity has
* been made persistent. It will be invoked after the database insert operations.
@ -67,6 +76,7 @@ final class Events
* @var string
*/
const postPersist = 'postPersist';
/**
* The preUpdate event occurs before the database update operations to
* entity data.
@ -76,6 +86,7 @@ final class Events
* @var string
*/
const preUpdate = 'preUpdate';
/**
* The postUpdate event occurs after the database update operations to
* entity data.
@ -85,6 +96,7 @@ final class Events
* @var string
*/
const postUpdate = 'postUpdate';
/**
* 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
@ -99,6 +111,7 @@ final class Events
* @var string
*/
const postLoad = 'postLoad';
/**
* The loadClassMetadata event occurs after the mapping metadata for a class
* 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.
*
* @param \Doctrine\ORM\EntityManager $em
* @param \Doctrine\ORM\Mapping\Entity $entity
*
* @return mixed
*/
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.
*
* @param EntityManager $em
* @param object $entity
*
* @return mixed
*
* @throws \Doctrine\ORM\ORMException
*
* @override
*/
public function generate(EntityManager $em, $entity)

View File

@ -28,11 +28,17 @@ use Doctrine\ORM\EntityManager;
*/
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;
/**
* @param string $seqName The name of the sequence to pass to lastInsertId()
* Constructor.
*
* @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.
*/

View File

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

View File

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

View File

@ -19,7 +19,6 @@
namespace Doctrine\ORM\Id;
use Serializable;
use Doctrine\ORM\EntityManager;
/**
@ -30,13 +29,14 @@ use Doctrine\ORM\EntityManager;
*/
class UuidGenerator extends AbstractIdGenerator
{
/**
* 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
*
* @return string The generated value.
*
* @override
*/
public function generate(EntityManager $em, $entity)
@ -45,5 +45,4 @@ class UuidGenerator extends AbstractIdGenerator
$sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression();
return $conn->query($sql)->fetchColumn(0);
}
}

View File

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

View File

@ -20,7 +20,6 @@
namespace Doctrine\ORM\Internal\Hydration;
use PDO;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Events;
@ -37,25 +36,53 @@ use Doctrine\ORM\Mapping\ClassMetadata;
*/
abstract class AbstractHydrator
{
/** @var \Doctrine\ORM\Query\ResultSetMapping The ResultSetMapping. */
/**
* The ResultSetMapping.
*
* @var \Doctrine\ORM\Query\ResultSetMapping
*/
protected $_rsm;
/** @var EntityManager The EntityManager instance. */
/**
* The EntityManager instance.
*
* @var EntityManager
*/
protected $_em;
/** @var \Doctrine\DBAL\Platforms\AbstractPlatform The dbms Platform instance */
/**
* The dbms Platform instance.
*
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
*/
protected $_platform;
/** @var \Doctrine\ORM\UnitOfWork The UnitOfWork of the associated EntityManager. */
/**
* The UnitOfWork of the associated EntityManager.
*
* @var \Doctrine\ORM\UnitOfWork
*/
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();
/** @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;
/** @var array The query hints. */
/**
* The query hints.
*
* @var array
*/
protected $_hints;
/**
@ -75,6 +102,7 @@ abstract class AbstractHydrator
*
* @param object $stmt
* @param object $resultSetMapping
* @param array $hints
*
* @return IterableResult
*/
@ -98,7 +126,8 @@ abstract class AbstractHydrator
* @param object $stmt
* @param object $resultSetMapping
* @param array $hints
* @return mixed
*
* @return 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
* through {@link hydrateAll} or {@link iterate()}.
*
* @return void
*/
protected function prepare()
{}
{
}
/**
* Excutes one-time cleanup tasks at the end of a hydration that was initiated
* through {@link hydrateAll} or {@link iterate()}.
*
* @return void
*/
protected function cleanup()
{
@ -164,7 +198,11 @@ abstract class AbstractHydrator
*
* @param array $data The row data.
* @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)
{
@ -173,6 +211,8 @@ abstract class AbstractHydrator
/**
* Hydrates all rows from the current statement instance at once.
*
* @return array
*/
abstract protected function hydrateAllData();
@ -185,9 +225,9 @@ abstract class AbstractHydrator
* field names during this procedure as well as any necessary conversions on
* the values applied. Scalar values are kept in a specfic key 'scalars'.
*
* @param array $data SQL Result Row
* @param array &$cache Cache for column to field result information
* @param array &$id Dql-Alias => ID-Hash
* @param array $data SQL Result Row.
* @param array &$cache Cache for column to field result information.
* @param array &$id Dql-Alias => ID-Hash.
* @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,
@ -371,10 +411,12 @@ abstract class AbstractHydrator
/**
* Register entity as managed in UnitOfWork.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
* @param ClassMetadata $class
* @param object $entity
* @param array $data
*
* @return void
*
* @todo The "$id" generation is the same of UnitOfWork#createEntity. Remove this duplication somehow
*/
protected function registerManaged(ClassMetadata $class, $entity, array $data)
@ -402,6 +444,10 @@ abstract class AbstractHydrator
/**
* When executed in a hydrate() loop we have to clear internal state to
* decrease memory consumption.
*
* @param mixed $eventArgs
*
* @return void
*/
public function onClear($eventArgs)
{

View File

@ -20,7 +20,6 @@
namespace Doctrine\ORM\Internal\Hydration;
use PDO;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Mapping\ClassMetadata;
/**
@ -33,12 +32,39 @@ use Doctrine\ORM\Mapping\ClassMetadata;
*/
class ArrayHydrator extends AbstractHydrator
{
/**
* @var array
*/
private $_ce = array();
/**
* @var array
*/
private $_rootAliases = array();
/**
* @var bool
*/
private $_isSimpleQuery = false;
/**
* @var array
*/
private $_identifierMap = array();
/**
* @var array
*/
private $_resultPointers = array();
/**
* @var array
*/
private $_idTemplate = array();
/**
* @var int
*/
private $_resultCounter = 0;
/**
@ -242,6 +268,8 @@ class ArrayHydrator extends AbstractHydrator
* @param boolean|integer $index Index of the element in the collection.
* @param string $dqlAlias
* @param boolean $oneToOne Whether it is a single-valued association or not.
*
* @return void
*/
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
{
/**
* @return HydrationException
*/
public static function nonUniqueResult()
{
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)
{
return new self("The parent object of entity result with alias '$alias' was not found."
. " The parent alias is '$parentAlias'.");
}
/**
* @param string $dqlAlias
*
* @return HydrationException
*/
public static function emptyDiscriminatorValue($dqlAlias)
{
return new self("The DQL alias '" . $dqlAlias . "' contains an entity ".
@ -43,9 +57,11 @@ class HydrationException extends \Doctrine\ORM\ORMException
/**
* @since 2.3
*
* @param string $entityName
* @param string $discrColumnName
* @param string $dqlAlias
*
* @return HydrationException
*/
public static function missingDiscriminatorColumn($entityName, $discrColumnName, $dqlAlias)
@ -58,9 +74,11 @@ class HydrationException extends \Doctrine\ORM\ORMException
/**
* @since 2.3
*
* @param string $entityName
* @param string $discrColumnName
* @param string $dqlAlias
*
* @return HydrationException
*/
public static function missingDiscriminatorMetaMappingColumn($entityName, $discrColumnName, $dqlAlias)

View File

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

View File

@ -38,8 +38,11 @@ use Doctrine\ORM\Proxy\Proxy;
*/
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.
*
* @var array
*/
private $ce = array();
@ -80,7 +83,6 @@ class ObjectHydrator extends AbstractHydrator
*/
private $existingCollections = array();
/**
* {@inheritdoc}
*/
@ -191,6 +193,8 @@ class ObjectHydrator extends AbstractHydrator
* @param ClassMetadata $class
* @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.
*
* @return \Doctrine\ORM\PersistentCollection
*/
private function initRelatedCollection($entity, $class, $fieldName, $parentDqlAlias)
{
@ -236,7 +240,10 @@ class ObjectHydrator extends AbstractHydrator
*
* @param array $data The instance data.
* @param string $dqlAlias The DQL alias of the entity's class.
*
* @return object The entity.
*
* @throws HydrationException
*/
private function getEntity(array $data, $dqlAlias)
{
@ -275,6 +282,7 @@ class ObjectHydrator extends AbstractHydrator
/**
* @param string $className
* @param array $data
*
* @return mixed
*/
private function getEntityFromIdentityMap($className, array $data)
@ -306,6 +314,7 @@ class ObjectHydrator extends AbstractHydrator
* local cache.
*
* @param string $className The name of the class.
*
* @return ClassMetadata
*/
private function getClassMetadata($className)
@ -337,6 +346,8 @@ class ObjectHydrator extends AbstractHydrator
* @param array $row The data of the row to process.
* @param array $cache The cache to use.
* @param array $result The result array to fill.
*
* @return void
*/
protected function hydrateRowData(array $row, array &$cache, array &$result)
{
@ -593,12 +604,15 @@ class ObjectHydrator extends AbstractHydrator
$result[$resultKey][$objIndex] = $obj;
}
}
}
/**
* When executed in a hydrate() loop we may have to clear internal state to
* decrease memory consumption.
*
* @param mixed $eventArgs
*
* @return void
*/
public function onClear($eventArgs)
{

View File

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

View File

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

View File

@ -30,9 +30,8 @@ namespace Doctrine\ORM\Mapping;
*/
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
*/
@ -45,12 +44,10 @@ final class AssociationOverride implements Annotation
*/
public $joinColumns;
/**
* The join table that maps the relationship.
*
* @var \Doctrine\ORM\Mapping\JoinTable
*/
public $joinTable;
}

View File

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

View File

@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
*/
final class AttributeOverride implements Annotation
{
/**
* 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
{
/**
* One or more field or property mapping overrides.
*
* @var array<\Doctrine\ORM\Mapping\AttributeOverride>
*/
public $value;
}

View File

@ -34,12 +34,11 @@ class AssociationBuilder
protected $mapping;
/**
* @var array
* @var array|null
*/
protected $joinColumns;
/**
*
* @var int
*/
protected $type;
@ -47,6 +46,7 @@ class AssociationBuilder
/**
* @param ClassMetadataBuilder $builder
* @param array $mapping
* @param int $type
*/
public function __construct(ClassMetadataBuilder $builder, array $mapping, $type)
{
@ -55,66 +55,103 @@ class AssociationBuilder
$this->type = $type;
}
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function mappedBy($fieldName)
{
$this->mapping['mappedBy'] = $fieldName;
return $this;
}
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function inversedBy($fieldName)
{
$this->mapping['inversedBy'] = $fieldName;
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeAll()
{
$this->mapping['cascade'] = array("ALL");
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadePersist()
{
$this->mapping['cascade'][] = "persist";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeRemove()
{
$this->mapping['cascade'][] = "remove";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeMerge()
{
$this->mapping['cascade'][] = "merge";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeDetach()
{
$this->mapping['cascade'][] = "detach";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeRefresh()
{
$this->mapping['cascade'][] = "refresh";
return $this;
}
/**
* @return AssociationBuilder
*/
public function fetchExtraLazy()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
return $this;
}
/**
* @return AssociationBuilder
*/
public function fetchEager()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
return $this;
}
/**
* @return AssociationBuilder
*/
public function fetchLazy()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
@ -122,14 +159,16 @@ class AssociationBuilder
}
/**
* Add Join Columns
* Add Join Columns.
*
* @param string $columnName
* @param string $referencedColumnName
* @param bool $nullable
* @param bool $unique
* @param string $onDelete
* @param string $columnDef
* @param string|null $onDelete
* @param string|null $columnDef
*
* @return AssociationBuilder
*/
public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{
@ -146,6 +185,8 @@ class AssociationBuilder
/**
* @return ClassMetadataBuilder
*
* @throws \InvalidArgumentException
*/
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
*/
@ -67,9 +67,10 @@ class ClassMetadataBuilder
}
/**
* Set custom Repository class name
* Sets custom Repository class name.
*
* @param string $repositoryClassName
*
* @return ClassMetadataBuilder
*/
public function setCustomRepositoryClass($repositoryClassName)
@ -80,7 +81,7 @@ class ClassMetadataBuilder
}
/**
* Mark class read only
* Marks class read only.
*
* @return ClassMetadataBuilder
*/
@ -92,9 +93,10 @@ class ClassMetadataBuilder
}
/**
* Set the table name
* Sets the table name.
*
* @param string $name
*
* @return ClassMetadataBuilder
*/
public function setTable($name)
@ -105,10 +107,11 @@ class ClassMetadataBuilder
}
/**
* Add Index
* Adds Index.
*
* @param array $columns
* @param string $name
*
* @return ClassMetadataBuilder
*/
public function addIndex(array $columns, $name)
@ -123,10 +126,11 @@ class ClassMetadataBuilder
}
/**
* Add Unique Constraint
* Adds Unique Constraint.
*
* @param array $columns
* @param string $name
*
* @return ClassMetadataBuilder
*/
public function addUniqueConstraint(array $columns, $name)
@ -141,10 +145,11 @@ class ClassMetadataBuilder
}
/**
* Add named query
* Adds named query.
*
* @param string $name
* @param string $dqlQuery
*
* @return ClassMetadataBuilder
*/
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
*/
@ -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
*/
@ -182,10 +187,13 @@ class ClassMetadataBuilder
}
/**
* Set the discriminator column details.
* Sets the discriminator column details.
*
* @param string $name
* @param string $type
* @param int $length
*
* @return ClassMetadataBuilder
*/
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 $class
*
* @return ClassMetadataBuilder
*/
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
*/
@ -225,7 +234,7 @@ class ClassMetadataBuilder
}
/**
* Set notify change tracking policy.
* Sets notify change tracking policy.
*
* @return ClassMetadataBuilder
*/
@ -237,10 +246,11 @@ class ClassMetadataBuilder
}
/**
* Add lifecycle event
* Adds lifecycle event.
*
* @param string $methodName
* @param string $event
*
* @return ClassMetadataBuilder
*/
public function addLifecycleEvent($methodName, $event)
@ -251,11 +261,13 @@ class ClassMetadataBuilder
}
/**
* Add Field
* Adds Field.
*
* @param string $name
* @param string $type
* @param array $mapping
*
* @return ClassMetadataBuilder
*/
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 $type
*
* @return FieldBuilder
*/
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 $targetEntity
* @param string|null $inversedBy
*
* @return ClassMetadataBuilder
*/
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.
*
* @param string $name
* @param string $targetEntity
*
* @return AssociationBuilder
*/
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 $targetEntity
*
* @return AssociationBuilder
*/
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 $targetEntity
* @param string $mappedBy
*
* @return ClassMetadataBuilder
*/
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 $inversedBy
* @param string|null $inversedBy
*
* @return ClassMetadataBuilder
*/
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 $targetEntity
*
* @return ManyToManyAssociationBuilder
*/
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 $targetEntity
* @param string|null $inversedBy
*
* @return ClassMetadataBuilder
*/
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 $targetEntity
* @param string $mappedBy
*
* @return ClassMetadataBuilder
*/
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 $targetEntity
*
* @return OneToManyAssociationBuilder
*/
public function createOneToMany($name, $targetEntity)
@ -453,11 +475,12 @@ class ClassMetadataBuilder
}
/**
* Add simple OneToMany assocation.
* Adds simple OneToMany assocation.
*
* @param string $name
* @param string $targetEntity
* @param string $mappedBy
*
* @return ClassMetadataBuilder
*/
public function addOneToMany($name, $targetEntity, $mappedBy)

View File

@ -33,10 +33,12 @@ class FieldBuilder
* @var ClassMetadataBuilder
*/
private $builder;
/**
* @var array
*/
private $mapping;
/**
* @var bool
*/
@ -53,7 +55,6 @@ class FieldBuilder
private $sequenceDef;
/**
*
* @param ClassMetadataBuilder $builder
* @param array $mapping
*/
@ -64,9 +65,10 @@ class FieldBuilder
}
/**
* Set length.
* Sets length.
*
* @param int $length
*
* @return FieldBuilder
*/
public function length($length)
@ -76,9 +78,10 @@ class FieldBuilder
}
/**
* Set nullable
* Sets nullable.
*
* @param bool $flag
*
* @param bool
* @return FieldBuilder
*/
public function nullable($flag = true)
@ -88,9 +91,10 @@ class FieldBuilder
}
/**
* Set Unique
* Sets Unique.
*
* @param bool $flag
*
* @param bool
* @return FieldBuilder
*/
public function unique($flag = true)
@ -100,9 +104,10 @@ class FieldBuilder
}
/**
* Set column name
* Sets column name.
*
* @param string $name
*
* @return FieldBuilder
*/
public function columnName($name)
@ -112,9 +117,10 @@ class FieldBuilder
}
/**
* Set Precision
* Sets Precision.
*
* @param int $p
*
* @return FieldBuilder
*/
public function precision($p)
@ -124,9 +130,10 @@ class FieldBuilder
}
/**
* Set scale.
* Sets scale.
*
* @param int $s
*
* @return FieldBuilder
*/
public function scale($s)
@ -136,7 +143,7 @@ class FieldBuilder
}
/**
* Set field as primary key.
* Sets field as primary key.
*
* @return FieldBuilder
*/
@ -147,7 +154,8 @@ class FieldBuilder
}
/**
* @param int $strategy
* @param string $strategy
*
* @return FieldBuilder
*/
public function generatedValue($strategy = 'AUTO')
@ -157,7 +165,7 @@ class FieldBuilder
}
/**
* Set field versioned
* Sets field versioned.
*
* @return FieldBuilder
*/
@ -168,11 +176,12 @@ class FieldBuilder
}
/**
* Set Sequence Generator
* Sets Sequence Generator.
*
* @param string $sequenceName
* @param int $allocationSize
* @param int $initialValue
*
* @return FieldBuilder
*/
public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1)
@ -186,9 +195,10 @@ class FieldBuilder
}
/**
* Set column definition.
* Sets column definition.
*
* @param string $def
*
* @return FieldBuilder
*/
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.
*

View File

@ -29,10 +29,21 @@ namespace Doctrine\ORM\Mapping\Builder;
*/
class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
{
/**
* @var string|null
*/
private $joinTableName;
/**
* @var array
*/
private $inverseJoinColumns = array();
/**
* @param string $name
*
* @return ManyToManyAssociationBuilder
*/
public function setJoinTable($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 $referencedColumnName
* @param bool $nullable
* @param bool $unique
* @param string $onDelete
* @param string $columnDef
* @param string|null $onDelete
* @param string|null $columnDef
*
* @return ManyToManyAssociationBuilder
*/
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
*
* @return OneToManyAssociationBuilder
*/
public function setOrderBy(array $fieldNames)
@ -39,6 +40,11 @@ class OneToManyAssociationBuilder extends AssociationBuilder
return $this;
}
/**
* @param string $fieldName
*
* @return OneToManyAssociationBuilder
*/
public function setIndexBy($fieldName)
{
$this->mapping['indexBy'] = $fieldName;

View File

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

View File

@ -174,7 +174,10 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Validate runtime metadata is correctly defined.
*
* @param ClassMetadata $class
* @param $parent
* @param ClassMetadataInterface|null $parent
*
* @return void
*
* @throws MappingException
*/
protected function validateRuntimeMetadata($class, $parent)
@ -226,6 +229,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* each class as key.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @throws MappingException
*/
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
*
* @return string
*/
private function getShortName($className)
@ -275,6 +280,8 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
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 $parentClass
*
* @return void
*
* @throws MappingException
*/
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
@ -324,8 +334,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named queries to the subclass mapping.
*
* @since 2.2
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
{
@ -343,8 +356,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named native queries to the subclass mapping.
*
* @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
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.
*
* @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, ClassMetadata $parentClass)
{
@ -396,6 +415,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* most appropriate for the targeted database platform.
*
* @param ClassMetadataInfo $class
*
* @return void
*
* @throws ORMException
*/
private function completeIdGeneratorMapping(ClassMetadataInfo $class)

View File

@ -29,7 +29,7 @@ use Doctrine\Common\ClassLoader;
/**
* A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata
* of an entity and it's associations.
* of an entity and its associations.
*
* Once populated, ClassMetadata instances are usually cached in a serialized form.
*
@ -111,10 +111,12 @@ class ClassMetadataInfo implements ClassMetadata
* portability is currently not guaranteed.
*/
const GENERATOR_TYPE_UUID = 6;
/**
* CUSTOM means that customer will use own ID generator that supposedly work
*/
const GENERATOR_TYPE_CUSTOM = 7;
/**
* DEFERRED_IMPLICIT means that changes of entities are calculated at commit-time
* by doing a property-by-property comparison with the original data. This will
@ -188,6 +190,8 @@ class ClassMetadataInfo implements ClassMetadata
/**
* READ-ONLY: The name of the entity class.
*
* @var string
*/
public $name;
@ -195,6 +199,7 @@ class ClassMetadataInfo implements ClassMetadata
* READ-ONLY: The namespace the entity class is contained in.
*
* @var string
*
* @todo Not really needed. Usage could be localized.
*/
public $namespace;
@ -220,6 +225,7 @@ class ClassMetadataInfo implements ClassMetadata
* </code>
*
* @var array
*
* @todo Merge with tableGeneratorDefinition into generic generatorDefinition
*/
public $customGeneratorDefinition;
@ -272,6 +278,8 @@ class ClassMetadataInfo implements ClassMetadata
* 'resultSetMapping' => <name of a SqlResultSetMapping>
* )
* </pre>
*
* @var array
*/
public $namedNativeQueries = array();
@ -286,6 +294,8 @@ class ClassMetadataInfo implements ClassMetadata
* 'columns' => array(<column result mapping>)
* )
* </pre>
*
* @var array
*/
public $sqlResultSetMappings = array();
@ -307,7 +317,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* READ-ONLY: The Id generator type used by the class.
*
* @var string
* @var int
*/
public $generatorType = self::GENERATOR_TYPE_NONE;
@ -369,6 +379,7 @@ class ClassMetadataInfo implements ClassMetadata
* This is the reverse lookup map of $_fieldNames.
*
* @var array
*
* @todo We could get rid of this array by just using $fieldMappings[$fieldName]['columnName'].
*/
public $columnNames = array();
@ -380,6 +391,7 @@ class ClassMetadataInfo implements ClassMetadata
* where a discriminator column is used.</b>
*
* @var mixed
*
* @see discriminatorColumn
*/
public $discriminatorValue;
@ -391,6 +403,7 @@ class ClassMetadataInfo implements ClassMetadata
* where a discriminator column is used.</b>
*
* @var mixed
*
* @see discriminatorColumn
*/
public $discriminatorMap = array();
@ -476,7 +489,6 @@ class ClassMetadataInfo implements ClassMetadata
* )
* </pre>
*
*
* @var array
*/
public $associationMappings = array();
@ -501,6 +513,7 @@ class ClassMetadataInfo implements ClassMetadata
* READ-ONLY: The ID generator used for generating IDs for this class.
*
* @var \Doctrine\ORM\Id\AbstractIdGenerator
*
* @todo Remove!
*/
public $idGenerator;
@ -519,6 +532,7 @@ class ClassMetadataInfo implements ClassMetadata
* </code>
*
* @var array
*
* @todo Merge with tableGeneratorDefinition into generic generatorDefinition
*/
public $sequenceGeneratorDefinition;
@ -528,6 +542,7 @@ class ClassMetadataInfo implements ClassMetadata
* TABLE generation strategy.
*
* @var array
*
* @todo Merge with tableGeneratorDefinition into generic generatorDefinition
*/
public $tableGeneratorDefinition;
@ -543,14 +558,14 @@ class ClassMetadataInfo implements ClassMetadata
* READ-ONLY: A flag for whether or not instances of this class are to be versioned
* with optimistic locking.
*
* @var boolean $isVersioned
* @var boolean
*/
public $isVersioned;
/**
* READ-ONLY: The name of the field which is used for versioning in optimistic locking (if any).
*
* @var mixed $versionField
* @var mixed
*/
public $versionField;
@ -573,7 +588,7 @@ class ClassMetadataInfo implements ClassMetadata
public $isReadOnly = false;
/**
* NamingStrategy determining the default column and table names
* NamingStrategy determining the default column and table names.
*
* @var \Doctrine\ORM\Mapping\NamingStrategy
*/
@ -598,7 +613,7 @@ class ClassMetadataInfo implements ClassMetadata
* metadata of the class with the given name.
*
* @param string $entityName The name of the entity class the new instance is used for.
* @param NamingStrategy $namingStrategy
* @param NamingStrategy|null $namingStrategy
*/
public function __construct($entityName, NamingStrategy $namingStrategy = null)
{
@ -621,6 +636,7 @@ class ClassMetadataInfo implements ClassMetadata
* Gets a ReflectionProperty for a specific field of the mapped class.
*
* @param string $name
*
* @return \ReflectionProperty
*/
public function getReflectionProperty($name)
@ -632,6 +648,7 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the ReflectionProperty for the single identifier field.
*
* @return \ReflectionProperty
*
* @throws BadMethodCallException If the class has a composite identifier.
*/
public function getSingleIdReflectionProperty()
@ -649,6 +666,7 @@ class ClassMetadataInfo implements ClassMetadata
* with the same order as the field order in {@link identifier}.
*
* @param object $entity
*
* @return array
*/
public function getIdentifierValues($entity)
@ -681,6 +699,9 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param object $entity
* @param mixed $id
*
* @return void
*
* @todo Rename to assignIdentifier()
*/
public function setIdentifierValues($entity, array $id)
@ -696,6 +717,8 @@ class ClassMetadataInfo implements ClassMetadata
* @param object $entity
* @param string $field
* @param mixed $value
*
* @return void
*/
public function setFieldValue($entity, $field, $value)
{
@ -707,6 +730,8 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param object $entity
* @param string $field
*
* @return mixed
*/
public function getFieldValue($entity, $field)
{
@ -717,6 +742,7 @@ class ClassMetadataInfo implements ClassMetadata
* Creates a string representation of this instance.
*
* @return string The string representation of this instance.
*
* @todo Construct meaningful string representation.
*/
public function __toString()
@ -836,6 +862,7 @@ class ClassMetadataInfo implements ClassMetadata
* Restores some state that can not be serialized/unserialized.
*
* @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
*
* @return void
*/
public function wakeupReflection($reflService)
@ -861,6 +888,8 @@ class ClassMetadataInfo implements ClassMetadata
* metadata of the class with the given name.
*
* @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService The reflection service.
*
* @return void
*/
public function initializeReflection($reflService)
{
@ -875,10 +904,11 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Validate Identifier
* Validates Identifier.
*
* @return void
*
* @throws MappingException
* @return void
*/
public function validateIdentifier()
{
@ -893,10 +923,11 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Validate association targets actually exist.
* Validates association targets actually exist.
*
* @return void
*
* @throws MappingException
* @return void
*/
public function validateAssocations()
{
@ -908,11 +939,13 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Validate lifecycle callbacks
* Validates lifecycle callbacks.
*
* @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
* @throws MappingException
*
* @return void
*
* @throws MappingException
*/
public function validateLifecycleCallbacks($reflService)
{
@ -937,6 +970,8 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the change tracking policy used by this class.
*
* @param integer $policy
*
* @return void
*/
public function setChangeTrackingPolicy($policy)
{
@ -976,7 +1011,8 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Checks whether a field is part of the identifier/primary key field(s).
*
* @param string $fieldName The field name
* @param string $fieldName The field name.
*
* @return boolean TRUE if the field is part of the table identifier/primary key field(s),
* FALSE otherwise.
*/
@ -989,9 +1025,10 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Check if the field is unique.
* Checks if the field is unique.
*
* @param string $fieldName The field name.
*
* @param string $fieldName The field name
* @return boolean TRUE if the field is unique, FALSE otherwise.
*/
public function isUniqueField($fieldName)
@ -1004,9 +1041,10 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Check if the field is not null.
* Checks if the field is not null.
*
* @param string $fieldName The field name.
*
* @param string $fieldName The field name
* @return boolean TRUE if the field is not null, FALSE otherwise.
*/
public function isNullable($fieldName)
@ -1024,6 +1062,7 @@ class ClassMetadataInfo implements ClassMetadata
* is returned.
*
* @param string $fieldName The field name.
*
* @return string The column name.
*/
public function getColumnName($fieldName)
@ -1037,8 +1076,10 @@ class ClassMetadataInfo implements ClassMetadata
* reference to another object.
*
* @param string $fieldName The field name.
* @throws MappingException
*
* @return array The field mapping.
*
* @throws MappingException
*/
public function getFieldMapping($fieldName)
{
@ -1052,10 +1093,13 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the mapping of an association.
*
* @see ClassMetadataInfo::$associationMappings
*
* @param string $fieldName The field name that represents the association in
* the object model.
* @throws MappingException
*
* @return array The mapping.
*
* @throws MappingException
*/
public function getAssociationMapping($fieldName)
{
@ -1079,8 +1123,9 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the field name for a column name.
* If no field name can be found the column name is returned.
*
* @param string $columnName column name
* @return string column alias
* @param string $columnName The column name.
*
* @return string The column alias.
*/
public function getFieldName($columnName)
{
@ -1092,9 +1137,12 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the named query.
*
* @see ClassMetadataInfo::$namedQueries
* @throws MappingException
* @param string $queryName The query name
*
* @param string $queryName The query name.
*
* @return string
*
* @throws MappingException
*/
public function getNamedQuery($queryName)
{
@ -1118,9 +1166,12 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the named native query.
*
* @see ClassMetadataInfo::$namedNativeQueries
* @throws MappingException
* @param string $queryName The query name
*
* @param string $queryName The query name.
*
* @return array
*
* @throws MappingException
*/
public function getNamedNativeQuery($queryName)
{
@ -1145,9 +1196,12 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the result set mapping.
*
* @see ClassMetadataInfo::$sqlResultSetMappings
* @throws MappingException
* @param string $name The result set mapping name
*
* @param string $name The result set mapping name.
*
* @return array
*
* @throws MappingException
*/
public function getSqlResultSetMapping($name)
{
@ -1171,9 +1225,11 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Validates & completes the given field mapping.
*
* @param array $mapping The field mapping to validated & complete.
* @throws MappingException
* @param array $mapping The field mapping to validate & complete.
*
* @return array The validated and completed field mapping.
*
* @throws MappingException
*/
protected function _validateAndCompleteFieldMapping(array &$mapping)
{
@ -1232,7 +1288,9 @@ class ClassMetadataInfo implements ClassMetadata
* association mappings (one-to-one, many-ot-one, one-to-many, many-to-many).
*
* @param array $mapping The mapping.
*
* @return array The updated mapping.
*
* @throws MappingException If something is wrong with the mapping.
*/
protected function _validateAndCompleteAssociationMapping(array $mapping)
@ -1350,9 +1408,11 @@ class ClassMetadataInfo implements ClassMetadata
* Validates & completes a one-to-one association mapping.
*
* @param array $mapping The mapping to validate & complete.
*
* @return array The validated & completed mapping.
*
* @throws RuntimeException
* @throws MappingException
* @return array The validated & completed mapping.@override
*/
protected function _validateAndCompleteOneToOneMapping(array $mapping)
{
@ -1429,12 +1489,14 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Validates and completes the mapping.
* Validates & completes a one-to-many association mapping.
*
* @param array $mapping The mapping to validate and complete.
*
* @return array The validated and completed mapping.
*
* @throws MappingException
* @throws InvalidArgumentException
* @return array The validated and completed mapping.@override
*/
protected function _validateAndCompleteOneToManyMapping(array $mapping)
{
@ -1457,6 +1519,15 @@ class ClassMetadataInfo implements ClassMetadata
return $mapping;
}
/**
* Validates & completes a many-to-many association mapping.
*
* @param array $mapping The mapping to validate & complete.
*
* @return array The validated & completed mapping.
*
* @throws \InvalidArgumentException
*/
protected function _validateAndCompleteManyToManyMapping(array $mapping)
{
$mapping = $this->_validateAndCompleteAssociationMapping($mapping);
@ -1560,6 +1631,7 @@ class ClassMetadataInfo implements ClassMetadata
* entity classes that have a single-field pk.
*
* @return string
*
* @throws MappingException If the class has a composite primary key.
*/
public function getSingleIdentifierFieldName()
@ -1575,6 +1647,7 @@ class ClassMetadataInfo implements ClassMetadata
* entity classes that have a single-field pk.
*
* @return string
*
* @throws MappingException If the class has a composite primary key.
*/
public function getSingleIdentifierColumnName()
@ -1588,6 +1661,8 @@ class ClassMetadataInfo implements ClassMetadata
* Mainly used by the ClassMetadataFactory to assign inherited identifiers.
*
* @param array $identifier
*
* @return void
*/
public function setIdentifier(array $identifier)
{
@ -1598,7 +1673,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Gets the mapped identifier field of this class.
*
* @return array|string $identifier
* @return array|string
*/
public function getIdentifier()
{
@ -1616,7 +1691,8 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Gets an array containing all the column names.
*
* @param array $fieldNames
* @param array|null $fieldNames
*
* @return array
*/
public function getColumnNames(array $fieldNames = null)
@ -1660,6 +1736,10 @@ class ClassMetadataInfo implements ClassMetadata
/**
* Sets the type of Id generator to use for the mapped class.
*
* @param int $generatorType
*
* @return void
*/
public function setIdGeneratorType($generatorType)
{
@ -1759,7 +1839,7 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Checks whether the class use a UUID for id generation
* Checks whether the class use a UUID for id generation.
*
* @return boolean
*/
@ -1772,7 +1852,8 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the type of a field.
*
* @param string $fieldName
* @return \Doctrine\DBAL\Types\Type|string
*
* @return \Doctrine\DBAL\Types\Type|string|null
*/
public function getTypeOfField($fieldName)
{
@ -1784,6 +1865,7 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the type of a column.
*
* @param string $columnName
*
* @return \Doctrine\DBAL\Types\Type
*/
public function getTypeOfColumn($columnName)
@ -1816,6 +1898,8 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the mapped subclasses of this class.
*
* @param array $subclasses The names of all mapped subclasses.
*
* @return void
*/
public function setSubclasses(array $subclasses)
{
@ -1832,6 +1916,10 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the parent class names.
* Assumes that the class names in the passed array are in the order:
* directParent -> directParentParent -> directParentParentParent ... -> root.
*
* @param array $classNames
*
* @return void
*/
public function setParentClasses(array $classNames)
{
@ -1842,11 +1930,13 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Sets the inheritance type used by the class and it's subclasses.
* Sets the inheritance type used by the class and its subclasses.
*
* @param integer $type
* @throws MappingException
*
* @return void
*
* @throws MappingException
*/
public function setInheritanceType($type)
{
@ -1861,8 +1951,10 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param string $fieldName
* @param array $overrideMapping
* @throws MappingException
*
* @return void
*
* @throws MappingException
*/
public function setAssociationOverride($fieldName, array $overrideMapping)
{
@ -1909,9 +2001,10 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param string $fieldName
* @param array $overrideMapping
* @throws MappingException
* @param array $overrideMapping
*
* @return void
*
* @throws MappingException
*/
public function setAttributeOverride($fieldName, array $overrideMapping)
{
@ -1949,6 +2042,7 @@ class ClassMetadataInfo implements ClassMetadata
* Checks whether a mapped field is inherited from an entity superclass.
*
* @param string $fieldName
*
* @return bool TRUE if the field is inherited, FALSE otherwise.
*/
public function isInheritedField($fieldName)
@ -1957,7 +2051,7 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Check if this entity is the root in any entity-inheritance-hierachy.
* Checks if this entity is the root in any entity-inheritance-hierachy.
*
* @return bool
*/
@ -1970,6 +2064,7 @@ class ClassMetadataInfo implements ClassMetadata
* Checks whether a mapped association field is inherited from a superclass.
*
* @param string $fieldName
*
* @return boolean TRUE if the field is inherited, FALSE otherwise.
*/
public function isInheritedAssociation($fieldName)
@ -1981,6 +2076,9 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the name of the primary table the class is mapped to.
*
* @param string $tableName The table name.
*
* @return void
*
* @deprecated Use {@link setPrimaryTable}.
*/
public function setTableName($tableName)
@ -1999,6 +2097,8 @@ class ClassMetadataInfo implements ClassMetadata
* If a key is omitted, the current value is kept.
*
* @param array $table The table description.
*
* @return void
*/
public function setPrimaryTable(array $table)
{
@ -2028,6 +2128,7 @@ class ClassMetadataInfo implements ClassMetadata
* Checks whether the given type identifies an inheritance type.
*
* @param integer $type
*
* @return boolean TRUE if the given type identifies an inheritance type, FALSe otherwise.
*/
private function _isInheritanceType($type)
@ -2042,8 +2143,10 @@ class ClassMetadataInfo implements ClassMetadata
* Adds a mapped field to the class.
*
* @param array $mapping The field mapping.
* @throws MappingException
*
* @return void
*
* @throws MappingException
*/
public function mapField(array $mapping)
{
@ -2060,8 +2163,10 @@ class ClassMetadataInfo implements ClassMetadata
* This is mainly used to add inherited association mappings to derived classes.
*
* @param array $mapping
* @throws MappingException
*
* @return void
*
* @throws MappingException
*/
public function addInheritedAssociationMapping(array $mapping/*, $owningClassName = null*/)
{
@ -2077,6 +2182,7 @@ class ClassMetadataInfo implements ClassMetadata
* This is mainly used to add inherited field mappings to derived classes.
*
* @param array $fieldMapping
*
* @return void
*/
public function addInheritedFieldMapping(array $fieldMapping)
@ -2090,8 +2196,11 @@ class ClassMetadataInfo implements ClassMetadata
* INTERNAL:
* Adds a named query to this class.
*
* @throws MappingException
* @param array $queryMapping
*
* @return void
*
* @throws MappingException
*/
public function addNamedQuery(array $queryMapping)
{
@ -2121,8 +2230,11 @@ class ClassMetadataInfo implements ClassMetadata
* INTERNAL:
* Adds a named native query to this class.
*
* @throws MappingException
* @param array $queryMapping
*
* @return void
*
* @throws MappingException
*/
public function addNamedNativeQuery(array $queryMapping)
{
@ -2164,8 +2276,11 @@ class ClassMetadataInfo implements ClassMetadata
* INTERNAL:
* Adds a sql result set mapping to this class.
*
* @throws MappingException
* @param array $resultMapping
*
* @return void
*
* @throws MappingException
*/
public function addSqlResultSetMapping(array $resultMapping)
{
@ -2222,6 +2337,8 @@ class ClassMetadataInfo implements ClassMetadata
* Adds a one-to-one mapping.
*
* @param array $mapping The mapping.
*
* @return void
*/
public function mapOneToOne(array $mapping)
{
@ -2234,6 +2351,8 @@ class ClassMetadataInfo implements ClassMetadata
* Adds a one-to-many mapping.
*
* @param array $mapping The mapping.
*
* @return void
*/
public function mapOneToMany(array $mapping)
{
@ -2246,6 +2365,8 @@ class ClassMetadataInfo implements ClassMetadata
* Adds a many-to-one mapping.
*
* @param array $mapping The mapping.
*
* @return void
*/
public function mapManyToOne(array $mapping)
{
@ -2259,6 +2380,8 @@ class ClassMetadataInfo implements ClassMetadata
* Adds a many-to-many mapping.
*
* @param array $mapping The mapping.
*
* @return void
*/
public function mapManyToMany(array $mapping)
{
@ -2271,8 +2394,10 @@ class ClassMetadataInfo implements ClassMetadata
* Stores the association mapping.
*
* @param array $assocMapping
* @throws MappingException
*
* @return void
*
* @throws MappingException
*/
protected function _storeAssociationMapping(array $assocMapping)
{
@ -2289,6 +2414,7 @@ class ClassMetadataInfo implements ClassMetadata
* Registers a custom repository class for the entity class.
*
* @param string $repositoryClassName The class name of the custom mapper.
*
* @return void
*/
public function setCustomRepositoryClass($repositoryClassName)
@ -2305,7 +2431,9 @@ class ClassMetadataInfo implements ClassMetadata
* lifecycle callbacks and lifecycle listeners.
*
* @param string $lifecycleEvent The lifecycle event.
* @param \Object $entity The Entity on which the event occured.
* @param object $entity The Entity on which the event occured.
*
* @return void
*/
public function invokeLifecycleCallbacks($lifecycleEvent, $entity)
{
@ -2318,6 +2446,7 @@ class ClassMetadataInfo implements ClassMetadata
* Whether the class has any attached lifecycle listeners or callbacks for a lifecycle event.
*
* @param string $lifecycleEvent
*
* @return boolean
*/
public function hasLifecycleCallbacks($lifecycleEvent)
@ -2329,6 +2458,7 @@ class ClassMetadataInfo implements ClassMetadata
* Gets the registered lifecycle callbacks for an event.
*
* @param string $event
*
* @return array
*/
public function getLifecycleCallbacks($event)
@ -2341,6 +2471,8 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param string $callback
* @param string $event
*
* @return void
*/
public function addLifecycleCallback($callback, $event)
{
@ -2352,6 +2484,8 @@ class ClassMetadataInfo implements ClassMetadata
* Any previously registered callbacks are overwritten.
*
* @param array $callbacks
*
* @return void
*/
public function setLifecycleCallbacks(array $callbacks)
{
@ -2363,9 +2497,10 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param array $columnDef
*
* @param $columnDef
* @throws MappingException
* @return void
*
* @throws MappingException
*
* @see getDiscriminatorColumn()
*/
public function setDiscriminatorColumn($columnDef)
@ -2400,6 +2535,8 @@ class ClassMetadataInfo implements ClassMetadata
* Used for JOINED and SINGLE_TABLE inheritance mapping strategies.
*
* @param array $map
*
* @return void
*/
public function setDiscriminatorMap(array $map)
{
@ -2409,12 +2546,14 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Add one entry of the discriminator map with a new class and corresponding name.
* Adds one entry of the discriminator map with a new class and corresponding name.
*
* @param string $name
* @param string $className
* @throws MappingException
*
* @return void
*
* @throws MappingException
*/
public function addDiscriminatorMapClass($name, $className)
{
@ -2441,6 +2580,7 @@ class ClassMetadataInfo implements ClassMetadata
* Checks whether the class has a named query with the given query name.
*
* @param string $queryName
*
* @return boolean
*/
public function hasNamedQuery($queryName)
@ -2452,6 +2592,7 @@ class ClassMetadataInfo implements ClassMetadata
* Checks whether the class has a named native query with the given query name.
*
* @param string $queryName
*
* @return boolean
*/
public function hasNamedNativeQuery($queryName)
@ -2463,6 +2604,7 @@ class ClassMetadataInfo implements ClassMetadata
* Checks whether the class has a named native query with the given query name.
*
* @param string $name
*
* @return boolean
*/
public function hasSqlResultSetMapping($name)
@ -2500,6 +2642,7 @@ class ClassMetadataInfo implements ClassMetadata
* Is this an association that only has a single join column?
*
* @param string $fieldName
*
* @return bool
*/
public function isAssociationWithSingleJoinColumn($fieldName)
@ -2512,11 +2655,13 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Return the single association join column (if any).
* Returns the single association join column (if any).
*
* @param string $fieldName
* @throws MappingException
*
* @return string
*
* @throws MappingException
*/
public function getSingleAssociationJoinColumnName($fieldName)
{
@ -2527,11 +2672,13 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Return the single association referenced join column name (if any).
* Returns the single association referenced join column name (if any).
*
* @param string $fieldName
* @throws MappingException
*
* @return string
*
* @throws MappingException
*/
public function getSingleAssociationReferencedJoinColumnName($fieldName)
{
@ -2542,13 +2689,15 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Used to retrieve a fieldname for either field or association from a given column,
* Used to retrieve a fieldname for either field or association from a given column.
*
* This method is used in foreign-key as primary-key contexts.
*
* @param string $columnName
* @throws MappingException
*
* @return string
*
* @throws MappingException
*/
public function getFieldForColumn($columnName)
{
@ -2571,6 +2720,8 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the ID generator used to generate IDs for instances of this class.
*
* @param \Doctrine\ORM\Id\AbstractIdGenerator $generator
*
* @return void
*/
public function setIdGenerator($generator)
{
@ -2578,8 +2729,11 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Sets definition
* Sets definition.
*
* @param array $definition
*
* @return void
*/
public function setCustomGeneratorDefinition(array $definition)
{
@ -2600,6 +2754,8 @@ class ClassMetadataInfo implements ClassMetadata
* </code>
*
* @param array $definition
*
* @return void
*/
public function setSequenceGeneratorDefinition(array $definition)
{
@ -2615,9 +2771,11 @@ class ClassMetadataInfo implements ClassMetadata
* Sets the version field mapping used for versioning. Sets the default
* value to use depending on the column type.
*
* @param array $mapping The version field mapping array
* @throws MappingException
* @param array $mapping The version field mapping array.
*
* @return void
*
* @throws MappingException
*/
public function setVersionMapping(array &$mapping)
{
@ -2639,6 +2797,8 @@ class ClassMetadataInfo implements ClassMetadata
* Sets whether this class is to be versioned for optimistic locking.
*
* @param boolean $bool
*
* @return void
*/
public function setVersioned($bool)
{
@ -2650,6 +2810,8 @@ class ClassMetadataInfo implements ClassMetadata
* versioned for optimistic locking.
*
* @param string $versionField
*
* @return void
*/
public function setVersionField($versionField)
{
@ -2657,7 +2819,7 @@ class ClassMetadataInfo implements ClassMetadata
}
/**
* Mark this class as read only, no change tracking is applied to it.
* Marks this class as read only, no change tracking is applied to it.
*
* @return void
*/
@ -2684,6 +2846,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* {@inheritDoc}
*
* @throws InvalidArgumentException
*/
public function getAssociationTargetClass($assocName)
@ -2709,6 +2872,7 @@ class ClassMetadataInfo implements ClassMetadata
* @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
*
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*
* @return array
*/
public function getQuotedIdentifierColumnNames($platform)
@ -2748,6 +2912,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param string $field
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*
* @return string
*/
public function getQuotedColumnName($field, $platform)
@ -2763,6 +2928,7 @@ class ClassMetadataInfo implements ClassMetadata
* @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
*
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*
* @return string
*/
public function getQuotedTableName($platform)
@ -2777,6 +2943,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @param array $assoc
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*
* @return string
*/
public function getQuotedJoinTableName(array $assoc, $platform)
@ -2802,6 +2969,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* @param string $targetClass
*
* @return array
*/
public function getAssociationsByTargetClass($targetClass)

View File

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

View File

@ -31,12 +31,10 @@ namespace Doctrine\ORM\Mapping;
*/
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
*/
public $name;
}

View File

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

View File

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

View File

@ -25,14 +25,30 @@ namespace Doctrine\ORM\Mapping;
*/
final class DiscriminatorColumn implements Annotation
{
/** @var string */
/**
* @var string
*/
public $name;
/** @var string */
/**
* @var string
*/
public $type;
/** @var integer */
/**
* @var integer
*/
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;
}

View File

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

View File

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

View File

@ -19,18 +19,17 @@
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\DBAL\Schema\AbstractSchemaManager,
Doctrine\DBAL\Schema\SchemaException,
Doctrine\Common\Persistence\Mapping\Driver\MappingDriver,
Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\ClassMetadataInfo,
Doctrine\Common\Util\Inflector,
Doctrine\ORM\Mapping\MappingException;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\Common\Util\Inflector;
use Doctrine\ORM\Mapping\MappingException;
/**
* The DatabaseDriver reverse engineers the mapping metadata from a database.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
@ -45,10 +44,13 @@ class DatabaseDriver implements MappingDriver
private $_sm;
/**
* @var array
* @var array|null
*/
private $tables = null;
/**
* @var array
*/
private $classToTableNames = array();
/**
@ -69,12 +71,11 @@ class DatabaseDriver implements MappingDriver
/**
* The namespace for the generated entities.
*
* @var string
* @var string|null
*/
private $namespace;
/**
*
* @param 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 $manyToManyTables
*
* @return void
*/
public function setTables($entityTables, $manyToManyTables)
@ -102,6 +104,11 @@ class DatabaseDriver implements MappingDriver
}
}
/**
* @return void
*
* @throws \Doctrine\ORM\Mapping\MappingException
*/
private function reverseEngineerMappingFromDatabase()
{
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 $className
*
* @return void
*/
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 $columnName
* @param string $fieldName
*
* @return void
*/
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
*
* @return string
*/
private function getClassNameForTable($tableName)
@ -385,6 +395,7 @@ class DatabaseDriver implements MappingDriver
* @param string $tableName
* @param string $columnName
* @param boolean $fk Whether the column is a foreignkey or not.
*
* @return string
*/
private function getFieldNameForColumn($tableName, $columnName, $fk = false)
@ -406,6 +417,7 @@ class DatabaseDriver implements MappingDriver
* Set the namespace for the generated entities.
*
* @param string $namespace
*
* @return void
*/
public function setNamespace($namespace)

View File

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

View File

@ -19,10 +19,10 @@
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\Common\Persistence\Mapping\Driver\FileDriver,
Doctrine\ORM\Mapping\MappingException,
Symfony\Component\Yaml\Yaml;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
use Doctrine\ORM\Mapping\MappingException;
use Symfony\Component\Yaml\Yaml;
/**
* 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
* 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.
*/
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
*
* @return array
*/
private function columnToArray($fieldName, $column)

View File

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

View File

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

View File

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

View File

@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
*/
final class FieldResult implements Annotation
{
/**
* Name of the column in the SELECT clause.
*
@ -44,5 +43,4 @@ final class FieldResult implements Annotation
* @var string
*/
public $column;
}

View File

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
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"})
*/

View File

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

View File

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
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"})
*/

View File

@ -25,18 +25,40 @@ namespace Doctrine\ORM\Mapping;
*/
final class JoinColumn implements Annotation
{
/** @var string */
/**
* @var string
*/
public $name;
/** @var string */
/**
* @var string
*/
public $referencedColumnName = 'id';
/** @var boolean */
/**
* @var boolean
*/
public $unique = false;
/** @var boolean */
/**
* @var boolean
*/
public $nullable = true;
/** @var mixed */
/**
* @var mixed
*/
public $onDelete;
/** @var string */
/**
* @var string
*/
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
{
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $value;
}

View File

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

View File

@ -46,7 +46,9 @@ final class ManyToMany implements Annotation
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"})
*/

View File

@ -36,7 +36,9 @@ final class ManyToOne implements Annotation
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"})
*/

View File

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

View File

@ -26,12 +26,20 @@ namespace Doctrine\ORM\Mapping;
*/
class MappingException extends \Doctrine\ORM\ORMException
{
/**
* @return MappingException
*/
public static function pathRequired()
{
return new self("Specifying the paths to your entities is required ".
"in the AnnotationDriver to retrieve all class names.");
}
/**
* @param string $entityName
*
* @return MappingException
*/
public static function identifierRequired($entityName)
{
if (false !== ($parent = get_parent_class($entityName))) {
@ -48,31 +56,61 @@ class MappingException extends \Doctrine\ORM\ORMException
}
/**
* @param string $entityName
* @param string $type
*
* @return MappingException
*/
public static function invalidInheritanceType($entityName, $type)
{
return new self("The inheritance type '$type' specified for '$entityName' does not exist.");
}
/**
* @return MappingException
*/
public static function generatorNotAllowedWithCompositeId()
{
return new self("Id generators can't be used with a composite id.");
}
/**
* @param string $entity
*
* @return MappingException
*/
public static function missingFieldName($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)
{
return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute.");
}
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function missingSourceEntity($fieldName)
{
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)
{
return new self("No mapping file found named '$fileName' for class '$entityName'.");
@ -81,8 +119,10 @@ class MappingException extends \Doctrine\ORM\ORMException
/**
* Exception for invalid property name override.
*
* @param string $className The entity's name
* @param string $className The entity's name.
* @param string $fieldName
*
* @return MappingException
*/
public static function invalidOverrideFieldName($className, $fieldName)
{
@ -92,64 +132,128 @@ class MappingException extends \Doctrine\ORM\ORMException
/**
* Exception for invalid property type override.
*
* @param string $className The entity's name
* @param string $className The entity's name.
* @param string $fieldName
*
* @return MappingException
*/
public static function invalidOverrideFieldType($className, $fieldName)
{
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)
{
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)
{
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)
{
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)
{
return new self('Query named "'.$queryName.'" in "'.$entity.'" could not be empty.');
}
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForQueryMapping($className)
{
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)
{
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)
{
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)
{
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.');
}
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForSqlResultSetMapping($className)
{
return new self("Result set mapping name on entity class '$className' is not defined.");
}
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function oneToManyRequiresMappedBy($fieldName)
{
return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute.");
}
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function joinTableRequired($fieldName)
{
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
*
* @param string $field which field cannot be processed?
* @param string $expectedOption which option is required
* @param string $field Which field cannot be processed?
* @param string $expectedOption Which option is required
* @param string $hint Can optionally be used to supply a tip for common mistakes,
* e.g. "Did you think of the plural s?"
*
* @return MappingException
*/
static function missingRequiredOption($field, $expectedOption, $hint = '')
@ -179,6 +284,8 @@ class MappingException extends \Doctrine\ORM\ORMException
* Generic exception for invalid mappings.
*
* @param string $fieldName
*
* @return MappingException
*/
public static function invalidMapping($fieldName)
{
@ -192,18 +299,31 @@ class MappingException extends \Doctrine\ORM\ORMException
*
* @param string $entity The entity's name
* @param \ReflectionException $previousException
*
* @return MappingException
*/
public static function reflectionFailure($entity, \ReflectionException $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)
{
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.');
}
/**
* @param string $className
*
* @return MappingException
*/
public static function classIsNotAValidEntityOrMappedSuperClass($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)
{
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)
{
return new self("TableIdGenerator is not yet implemented for use with class ".$className);
}
/**
* @param string $entity The entity's name
* @param string $fieldName The name of the field that was already declared
* @param string $entity The entity's name.
* @param string $fieldName The name of the field that was already declared.
*
* @return MappingException
*/
public static function duplicateFieldMapping($entity, $fieldName)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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.
*
* @param string $className The class that could not be found
* @param string $owningClass The class that declares the discriminator map.
* @return self
*
* @return MappingException
*/
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)
{
return new self(
@ -304,31 +480,65 @@ class MappingException extends \Doctrine\ORM\ORMException
);
}
/**
* @param string $className
*
* @return MappingException
*/
public static function missingDiscriminatorMap($className)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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.");
@ -337,13 +547,20 @@ class MappingException extends \Doctrine\ORM\ORMException
/**
* @param string $className
* @param string $columnName
* @return self
*
* @return MappingException
*/
public static function duplicateColumnName($className, $columnName)
{
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)
{
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 $targetEntity
* @param string $targetField
* @return self
*
* @return MappingException
*/
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."'.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function noSingleAssociationJoinColumnFound($className, $field)
{
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)
{
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.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field)
{
return new self("The orphan removal option is not allowed on an association that is ".
"part of the identifier in '$className#$field'.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemoval($className, $field)
{
return new self("Orphan removal is only allowed on one-to-one and one-to-many ".
"associations, but " . $className."#" .$field . " is not.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalInverseIdentifierAssocation($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)
{
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)
{
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)
{
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)
{
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)
{
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
}
/**
* @param string $className
*
* @return MappingException
*/
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.");
}
/**
* @param string $targetEntity
* @param string $sourceEntity
* @param string $associationName
*
* @return MappingException
*/
public static function invalidTargetEntityClass($targetEntity, $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)
{
$cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));

View File

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/
final class NamedNativeQuery implements Annotation
{
/**
* 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
*/
public $resultSetMapping;
}

View File

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

View File

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

View File

@ -31,53 +31,58 @@ namespace Doctrine\ORM\Mapping;
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
* @return string A table name
* @param string $className The fully-qualified class name.
*
* @return string A table name.
*/
function classToTableName($className);
/**
* Return a column name for a property
* Returns a column name for a property.
*
* @param string $propertyName A property
* @param string $className The fully-qualified class name
* @return string A column name
* @param string $propertyName A property name.
* @param string|null $className The fully-qualified class name.
*
* @return string A column name.
*/
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();
/**
* Return a join column name for a property
* Returns a join column name for a property.
*
* @param string $propertyName A property
* @return string A join column name
* @param string $propertyName A property name.
*
* @return string A join column name.
*/
function joinColumnName($propertyName);
/**
* Return a join table name
* Returns a join table name.
*
* @param string $sourceEntity The source entity
* @param string $targetEntity The target entity
* @param string $propertyName A property
* @return string A join table name
* @param string $sourceEntity The source entity.
* @param string $targetEntity The target entity.
* @param string|null $propertyName A property name.
*
* @return string A join table name.
*/
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 $referencedColumnName A property
* @return string A join column name
* @param string $entityName An entity.
* @param string|null $referencedColumnName A property.
*
* @return string A join column name.
*/
function joinKeyColumnName($entityName, $referencedColumnName = null);
}

View File

@ -41,7 +41,9 @@ final class OneToMany implements Annotation
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"})
*/

View File

@ -46,7 +46,9 @@ final class OneToOne implements Annotation
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"})
*/

View File

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

View File

@ -23,7 +23,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
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
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
@ -36,6 +36,7 @@ interface QuoteStrategy
* @param string $fieldName
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
@ -45,6 +46,7 @@ interface QuoteStrategy
*
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getTableName(ClassMetadata $class, AbstractPlatform $platform);
@ -55,6 +57,7 @@ interface QuoteStrategy
* @param array $definition
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
@ -65,6 +68,7 @@ interface QuoteStrategy
* @param array $association
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
@ -75,6 +79,7 @@ interface QuoteStrategy
* @param array $joinColumn
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
@ -85,6 +90,7 @@ interface QuoteStrategy
* @param array $joinColumn
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
@ -94,6 +100,7 @@ interface QuoteStrategy
*
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return array
*/
function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
@ -104,7 +111,8 @@ interface QuoteStrategy
* @param string $columnName
* @param integer $counter
* @param AbstractPlatform $platform
* @param ClassMetadata $class
* @param ClassMetadata|null $class
*
* @return string
*/
function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);

View File

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

View File

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/
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.
*
@ -52,5 +51,4 @@ final class SqlResultSetMapping implements Annotation
* @var array<\Doctrine\ORM\Mapping\ColumnResult>
*/
public $columns = array();
}

View File

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

View File

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

View File

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

View File

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

View File

@ -27,6 +27,9 @@ namespace Doctrine\ORM;
*/
class NoResultException extends UnexpectedResultException
{
/**
* Constructor.
*/
public function __construct()
{
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
{
}

View File

@ -29,22 +29,41 @@ use Exception;
*/
class ORMException extends Exception
{
/**
* @return ORMException
*/
public static function missingMappingDriverImpl()
{
return new self("It's a requirement to specify a Metadata Driver and pass it ".
"to Doctrine\\ORM\\Configuration::setMetadataDriverImpl().");
}
/**
* @param string $queryName
*
* @return ORMException
*/
public static function namedQueryNotFound($queryName)
{
return new self('Could not find a named query by the name "' . $queryName . '"');
}
/**
* @param string $nativeQueryName
*
* @return ORMException
*/
public static function namedNativeQueryNotFound($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)
{
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)
{
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)
{
return new self("Unrecognized field: $field");
@ -73,37 +103,67 @@ class ORMException extends Exception
/**
* @param string $className
* @param string $field
*
* @return ORMException
*/
public static function invalidOrientation($className, $field)
{
return new self("Invalid order by orientation specified for " . $className . "#" . $field);
}
/**
* @param string $mode
*
* @return ORMException
*/
public static function invalidFlushMode($mode)
{
return new self("'$mode' is an invalid flush mode.");
}
/**
* @return ORMException
*/
public static function entityManagerClosed()
{
return new self("The EntityManager is closed.");
}
/**
* @param string $mode
*
* @return ORMException
*/
public static function invalidHydrationMode($mode)
{
return new self("'$mode' is an invalid hydration mode.");
}
/**
* @return ORMException
*/
public static function mismatchedEventManager()
{
return new self("Cannot use different EventManager instances for EntityManager and Connection.");
}
/**
* @param string $methodName
*
* @return ORMException
*/
public static function findByRequiresParameter($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)
{
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)
{
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.");
}
public static function notSupported() {
/**
* @return ORMException
*/
public static function notSupported()
{
return new self("This behaviour is (currently) not supported by Doctrine 2");
}
/**
* @return ORMException
*/
public static function queryCacheNotConfigured()
{
return new self('Query Cache is not configured.');
}
/**
* @return ORMException
*/
public static function metadataCacheNotConfigured()
{
return new self('Class Metadata Cache is not configured.');
}
/**
* @return ORMException
*/
public static function proxyClassesAlwaysRegenerating()
{
return new self('Proxy Classes are always regenerating.');
}
/**
* @param string $entityNamespaceAlias
*
* @return ORMException
*/
public static function unknownEntityNamespace($entityNamespaceAlias)
{
return new self(
@ -150,16 +238,32 @@ class ORMException extends Exception
);
}
/**
* @param string $className
*
* @return ORMException
*/
public static function invalidEntityRepository($className)
{
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)
{
return new self("The identifier $fieldName is missing for a query of " . $className);
}
/**
* @param string $functionName
*
* @return ORMException
*/
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.");

View File

@ -26,21 +26,42 @@ namespace Doctrine\ORM;
*/
class ORMInvalidArgumentException extends \InvalidArgumentException
{
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function scheduleInsertForManagedEntity($entity)
{
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)
{
return new self("Removed entity " . self::objToStr($entity) . " can not be scheduled for insertion.");
}
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function scheduleInsertTwice($entity)
{
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)
{
return new self(
@ -49,11 +70,22 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
);
}
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
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");
}
/**
* @param array $assoc
* @param object $entry
*
* @return ORMInvalidArgumentException
*/
static public function newEntityFoundThroughRelationship(array $assoc, $entry)
{
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."));
}
/**
* @param array $assoc
* @param object $entry
*
* @return ORMInvalidArgumentException
*/
static public function detachedEntityFoundThroughRelationship(array $assoc, $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.");
}
/**
* @param object $entity
*
* @return ORMInvalidArgumentException
*/
static public function entityNotManaged($entity)
{
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");
}
/**
* @param object $entity
* @param string $operation
*
* @return ORMInvalidArgumentException
*/
static public function entityHasNoIdentity($entity, $operation)
{
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)
{
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)
{
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)
{
return new self($context . ' expects parameter ' . $parameterIndex .
' to be an entity object, '. gettype($given) . ' given.');
}
/**
* @return ORMInvalidArgumentException
*/
public static function invalidCompositeIdentifier()
{
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.");
}
/**
* @return ORMInvalidArgumentException
*/
public static function invalidIdentifierBindingEntity()
{
return new self("Binding entities to query parameters only allowed for entities that have an identifier.");
@ -117,6 +191,7 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
* Helper method to show an object as string.
*
* @param object $obj
*
* @return string
*/
private static function objToStr($obj)

View File

@ -29,8 +29,15 @@ namespace Doctrine\ORM;
*/
class OptimisticLockException extends ORMException
{
/**
* @var object|null
*/
private $entity;
/**
* @param string $msg
* @param object $entity
*/
public function __construct($msg, $entity)
{
parent::__construct($msg);
@ -40,23 +47,40 @@ class OptimisticLockException extends ORMException
/**
* Gets the entity that caused the exception.
*
* @return object
* @return object|null
*/
public function getEntity()
{
return $this->entity;
}
/**
* @param object $entity
*
* @return OptimisticLockException
*/
public static function lockFailed($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)
{
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)
{
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\Selectable;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ExpressionBuilder;
use Closure;
@ -87,6 +86,8 @@ final class PersistentCollection implements Collection, Selectable
/**
* The class descriptor of the collection's entity type.
*
* @var ClassMetadata
*/
private $typeClass;
@ -117,7 +118,7 @@ final class PersistentCollection implements Collection, Selectable
*
* @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 array The collection elements.
* @param array $coll The collection elements.
*/
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.
*
* @param object $entity
* @param AssociationMapping $assoc
* @param array $assoc
*
* @return void
*/
public function setOwner($entity, array $assoc)
{
@ -152,6 +155,9 @@ final class PersistentCollection implements Collection, Selectable
return $this->owner;
}
/**
* @return Mapping\ClassMetadata
*/
public function getTypeClass()
{
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.
*
* @param mixed $element The element to add.
*
* @return void
*/
public function hydrateAdd($element)
{
@ -187,7 +195,9 @@ final class PersistentCollection implements Collection, Selectable
* Sets a keyed element in the collection during hydration.
*
* @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)
{
@ -206,6 +216,8 @@ final class PersistentCollection implements Collection, Selectable
/**
* Initializes the collection by loading its contents from the database
* if the collection is not yet initialized.
*
* @return void
*/
public function initialize()
{
@ -239,6 +251,8 @@ final class PersistentCollection implements Collection, Selectable
/**
* INTERNAL:
* Tells this collection to take a snapshot of its current state.
*
* @return void
*/
public function takeSnapshot()
{
@ -299,6 +313,8 @@ final class PersistentCollection implements Collection, Selectable
/**
* Marks this collection as changed/dirty.
*
* @return void
*/
private function changed()
{
@ -332,6 +348,8 @@ final class PersistentCollection implements Collection, Selectable
* Sets a boolean flag, indicating whether this collection is dirty.
*
* @param boolean $dirty Whether the collection should be marked dirty or not.
*
* @return void
*/
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.
*
* @param boolean $bool
*
* @return void
*/
public function setInitialized($bool)
{
@ -358,7 +378,9 @@ final class PersistentCollection implements Collection, Selectable
return $this->initialized;
}
/** {@inheritdoc} */
/**
* {@inheritdoc}
*/
public function first()
{
$this->initialize();
@ -366,7 +388,9 @@ final class PersistentCollection implements Collection, Selectable
return $this->coll->first();
}
/** {@inheritdoc} */
/**
* {@inheritdoc}
*/
public function last()
{
$this->initialize();
@ -668,6 +692,8 @@ final class PersistentCollection implements Collection, Selectable
* Called by PHP when this collection is serialized. Ensures that only the
* elements are properly serialized.
*
* @return array
*
* @internal Tried to implement Serializable first but that did not work well
* with circular references. This solution seems simpler and works well.
*/
@ -679,7 +705,7 @@ final class PersistentCollection implements Collection, Selectable
/* ArrayAccess implementation */
/**
* @see containsKey()
* {@inheritdoc}
*/
public function offsetExists($offset)
{
@ -687,7 +713,7 @@ final class PersistentCollection implements Collection, Selectable
}
/**
* @see get()
* {@inheritdoc}
*/
public function offsetGet($offset)
{
@ -695,8 +721,7 @@ final class PersistentCollection implements Collection, Selectable
}
/**
* @see add()
* @see set()
* {@inheritdoc}
*/
public function offsetSet($offset, $value)
{
@ -708,20 +733,23 @@ final class PersistentCollection implements Collection, Selectable
}
/**
* @see remove()
* {@inheritdoc}
*/
public function offsetUnset($offset)
{
return $this->remove($offset);
}
/**
* {@inheritdoc}
*/
public function key()
{
return $this->coll->key();
}
/**
* Gets the element of the collection at the current iterator position.
* {@inheritdoc}
*/
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()
{
@ -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.
* 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.
*
* @param int $offset
* @param int $length
* @param int|null $length
*
* @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:
* 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.
* 4. Lazy loading grabs entities from old owner object.
* 5. New collection is connected to old owner and leads to duplicate keys.
*
* @return void
*/
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.
*
* @param \Doctrine\Common\Collections\Criteria $criteria
*
* @return Collection
*
* @throws \RuntimeException
*/
public function matching(Criteria $criteria)
{
@ -835,4 +868,3 @@ final class PersistentCollection implements Collection, Selectable
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.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/
public function delete(PersistentCollection $coll)
{
@ -95,6 +97,8 @@ abstract class AbstractCollectionPersister
* Gets the SQL statement for deleting the given collection.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/
abstract protected function getDeleteSQL(PersistentCollection $coll);
@ -103,14 +107,18 @@ abstract class AbstractCollectionPersister
* the given collection.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/
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.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/
public function update(PersistentCollection $coll)
{
@ -125,9 +133,11 @@ abstract class AbstractCollectionPersister
}
/**
* Delete rows
* Deletes rows.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/
public function deleteRows(PersistentCollection $coll)
{
@ -140,9 +150,11 @@ abstract class AbstractCollectionPersister
}
/**
* Insert rows
* Inserts rows.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return void
*/
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
*
* @return integer
*
* @throws \BadMethodCallException
*/
public function count(PersistentCollection $coll)
{
@ -167,13 +181,15 @@ abstract class AbstractCollectionPersister
}
/**
* Slice elements
* Slices elements.
*
* @param \Doctrine\ORM\PersistentCollection $coll
* @param integer $offset
* @param integer $length
*
* @return array
*
* @throws \BadMethodCallException
*/
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 object $element
*
* @return boolean
*
* @throws \BadMethodCallException
*/
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 mixed $key
*
* @return boolean
*
* @throws \BadMethodCallException
*/
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 object $element
*
* @return mixed
*
* @throws \BadMethodCallException
*/
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 mixed $key
*
* @return void
*
* @throws \BadMethodCallException
*/
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 mixed $index
*
* @return mixed
*
* @throws \BadMethodCallException
*/
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.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return string
*/
abstract protected function getDeleteRowSQL(PersistentCollection $coll);
@ -257,6 +286,8 @@ abstract class AbstractCollectionPersister
*
* @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $element
*
* @return array
*/
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.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return string
*/
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.
*
* @param \Doctrine\ORM\PersistentCollection $coll
*
* @return string
*/
abstract protected function getInsertRowSQL(PersistentCollection $coll);
@ -280,6 +315,8 @@ abstract class AbstractCollectionPersister
*
* @param \Doctrine\ORM\PersistentCollection $coll
* @param mixed $element
*
* @return array
*/
abstract protected function getInsertRowSQLParameters(PersistentCollection $coll, $element);
}

View File

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

View File

@ -144,6 +144,7 @@ class BasicEntityPersister
* when INSERTing or UPDATEing an entity.
*
* @var array
*
* @see prepareInsertData($entity)
* @see prepareUpdateData($entity)
*/
@ -153,6 +154,7 @@ class BasicEntityPersister
* The map of quoted column names.
*
* @var array
*
* @see prepareInsertData($entity)
* @see prepareUpdateData($entity)
*/
@ -232,6 +234,8 @@ class BasicEntityPersister
* The entity remains queued until {@link executeInserts} is invoked.
*
* @param object $entity The entity to queue for insertion.
*
* @return void
*/
public function addInsert($entity)
{
@ -298,6 +302,8 @@ class BasicEntityPersister
*
* @param object $entity
* @param mixed $id
*
* @return void
*/
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 mixed $id
*
* @return mixed
*/
protected function fetchVersionValue($versionedClass, $id)
@ -343,6 +350,8 @@ class BasicEntityPersister
* from {@prepareUpdateData} on the target tables, thereby optionally applying versioning.
*
* @param object $entity The entity to update.
*
* @return void
*/
public function update($entity)
{
@ -373,6 +382,11 @@ class BasicEntityPersister
* @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 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)
{
@ -472,7 +486,9 @@ class BasicEntityPersister
/**
* @todo Add check for platform if it supports foreign keys/cascading.
*
* @param array $identifier
*
* @return void
*/
protected function deleteJoinTableRecords($identifier)
@ -538,6 +554,8 @@ class BasicEntityPersister
* Subclasses may override this method to customize the semantics of entity deletion.
*
* @param object $entity The entity to delete.
*
* @return void
*/
public function delete($entity)
{
@ -568,6 +586,7 @@ class BasicEntityPersister
* </code>
*
* @param object $entity The entity for which to prepare the data.
*
* @return array The prepared data.
*/
protected function prepareUpdateData($entity)
@ -658,7 +677,9 @@ class BasicEntityPersister
* The default insert data preparation is the same as for updates.
*
* @param object $entity The entity for which to prepare the data.
*
* @return array The prepared data for the tables to update.
*
* @see prepareUpdateData
*/
protected function prepareInsertData($entity)
@ -674,6 +695,7 @@ class BasicEntityPersister
* is always persisted to a single table with a BasicEntityPersister.
*
* @param string $fieldName The field name.
*
* @return string The table name.
*/
public function getOwningTable($fieldName)
@ -685,14 +707,15 @@ class BasicEntityPersister
* Loads an entity by a list of field criteria.
*
* @param array $criteria The criteria by which to load the entity.
* @param object $entity The entity to load the data into. If not specified,
* a new entity is created.
* @param $assoc The association that connects the entity to load to another entity, if any.
* @param object|null $entity The entity to load the data into. If not specified, a new entity is created.
* @param array|null $assoc The association that connects the entity to load to another entity, if any.
* @param array $hints Hints for entity creation.
* @param int $lockMode
* @param int $limit Limit number of results
* @param array $orderBy Criteria to order by
* @param int|null $limit Limit number of results.
* @param array|null $orderBy Criteria to order by.
*
* @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?
*/
public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = 0, $limit = null, array $orderBy = null)
@ -721,7 +744,10 @@ class BasicEntityPersister
* @param array $identifier The identifier of the entity to load. Must be provided if
* the association to load represents the owning side, otherwise
* the identifier is derived from the $sourceEntity.
*
* @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())
{
@ -792,6 +818,9 @@ class BasicEntityPersister
* @param array $id The identifier of the entity as an associative array from
* column or field names to values.
* @param object $entity The entity to refresh.
* @param int $lockMode
*
* @return void
*/
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
*
@ -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.
*
* @param \Doctrine\Common\Collections\Criteria $criteria
@ -865,9 +894,10 @@ class BasicEntityPersister
* Loads a list of entities by a list of field criteria.
*
* @param array $criteria
* @param array $orderBy
* @param int $limit
* @param int $offset
* @param array|null $orderBy
* @param int|null $limit
* @param int|null $offset
*
* @return array
*/
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 object $sourceEntity
* @param int|null $offset
* @param int|null $limit
*
* @return array
*/
public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
@ -898,7 +929,7 @@ 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 \Doctrine\DBAL\Statement $stmt
@ -919,7 +950,7 @@ class BasicEntityPersister
}
/**
* Hydrate a collection from a given dbal statement.
* Hydrates a collection from a given DBAL statement.
*
* @param array $assoc
* @param \Doctrine\DBAL\Statement $stmt
@ -946,11 +977,10 @@ class BasicEntityPersister
/**
* 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 PersistentCollection $coll The collection to fill.
* @param int|null $offset
* @param int|null $limit
*
* @return array
*/
public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
@ -960,6 +990,16 @@ class BasicEntityPersister
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)
{
$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.
*
* @param array|\Doctrine\Common\Collections\Criteria $criteria
* @param AssociationMapping $assoc
* @param string $orderBy
* @param array|null $assoc
* @param int $lockMode
* @param int $limit
* @param int $offset
* @param array $orderBy
* @param int|null $limit
* @param int|null $offset
* @param array|null $orderBy
*
* @return string
*/
protected function getSelectSQL($criteria, $assoc = null, $lockMode = 0, $limit = null, $offset = null, array $orderBy = null)
@ -1091,7 +1131,10 @@ class BasicEntityPersister
*
* @param array $orderBy
* @param string $baseTableAlias
*
* @return string
*
* @throws \Doctrine\ORM\ORMException
*/
protected final function getOrderBySQL(array $orderBy, $baseTableAlias)
{
@ -1267,7 +1310,8 @@ class BasicEntityPersister
* Gets the SQL join fragment used when selecting entities from a
* many-to-many association.
*
* @param ManyToManyMapping $manyToMany
* @param array $manyToMany
*
* @return string
*/
protected function getSelectManyToManyJoinSQL(array $manyToMany)
@ -1385,6 +1429,8 @@ class BasicEntityPersister
* @param ClassMetadata $class The class that declares this field. The table this class is
* mapped to must own the column for the given field.
* @param string $alias
*
* @return string
*/
protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r')
{
@ -1408,7 +1454,10 @@ class BasicEntityPersister
* Gets the SQL table alias for the given class name.
*
* @param string $className
* @param string $assocName
*
* @return string The SQL table alias.
*
* @todo Reconsider. Binding table aliases to class names is not such a good idea.
*/
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 int $lockMode
*
* @return void
*/
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
*/
@ -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
*
* @return string
*/
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 mixed $value
* @param array|null $assoc
* @param string $comparison
* @param string|null $comparison
*
* @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 array $assoc
* @param array|null $assoc
*
* @return string
*
* @throws \Doctrine\ORM\ORMException
*/
protected function getSelectConditionStatementColumnSQL($field, $assoc = null)
{
@ -1579,7 +1632,8 @@ class BasicEntityPersister
* or alter the criteria by which entities are selected.
*
* @param array $criteria
* @param AssociationMapping $assoc
* @param array|null $assoc
*
* @return string
*/
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 $offset
* @param int $limit
* @param int|null $offset
* @param int|null $limit
*
* @return array
*/
public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
@ -1615,8 +1670,8 @@ class BasicEntityPersister
* @param array $assoc
* @param object $sourceEntity
* @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)
{
@ -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 object $sourceEntity
* @param int|null $offset
* @param int|null $limit
*
* @return \Doctrine\DBAL\Statement
*/
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
*
* @return array
*/
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 mixed $value
*
* @return integer
*
* @throws \Doctrine\ORM\Query\QueryException
*/
private function getType($field, $value)
{
@ -1733,9 +1793,10 @@ class BasicEntityPersister
}
/**
* Retrieve parameter value
* Retrieves parameter value.
*
* @param mixed $value
*
* @return mixed
*/
private function getValue($value)
@ -1754,9 +1815,10 @@ class BasicEntityPersister
}
/**
* Retrieve an individual parameter value
* Retrieves an individual parameter value.
*
* @param mixed $value
*
* @return mixed
*/
private function getIndividualValue($value)
@ -1781,6 +1843,8 @@ class BasicEntityPersister
* Checks whether the given managed entity exists in the database.
*
* @param object $entity
* @param array $extraConditions
*
* @return boolean TRUE if the entity exists in the database, FALSE otherwise.
*/
public function exists($entity, array $extraConditions = array())
@ -1814,6 +1878,7 @@ class BasicEntityPersister
* Generates the appropriate join SQL for the given join column.
*
* @param array $joinColumns The join columns definition of an association.
*
* @return string LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise.
*/
protected function getJoinSQLForJoinColumns($joinColumns)
@ -1832,6 +1897,7 @@ class BasicEntityPersister
* Gets an SQL column alias for a column name.
*
* @param string $columnName
*
* @return string
*/
public function getSQLColumnAlias($columnName)

View File

@ -26,5 +26,4 @@ namespace Doctrine\ORM\Persisters;
*/
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.
*
* @param string $fieldName
*
* @return string
*
* @override
*/
public function getOwningTable($fieldName)
@ -408,8 +410,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
return 'FROM ' . $quotedTableName . ' ' . $baseTableAlias . $joinSql;
}
/*
/**
* Ensure this method is never called. This persister overrides getSelectEntitiesSQL directly.
*
* @return string
*/
protected function getSelectColumnsSQL()
{
@ -548,5 +552,4 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
$value = $this->fetchVersionValue($this->getVersionedClassMetadata(), $id);
$this->class->setFieldValue($entity, $this->class->versionField, $value);
}
}

View File

@ -61,6 +61,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc}
*
* @override
*
* @internal Order of the parameters must be the same as the order of the columns in getDeleteRowSql.
*/
protected function getDeleteRowSQLParameters(PersistentCollection $coll, $element)
@ -82,6 +83,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc}
*
* @override
*
* @internal Order of the parameters must be the same as the order of the columns in getInsertRowSql.
*/
protected function getInsertRowSQL(PersistentCollection $coll)
@ -107,6 +109,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc}
*
* @override
*
* @internal Order of the parameters must be the same as the order of the columns in getInsertRowSql.
*/
protected function getInsertRowSQLParameters(PersistentCollection $coll, $element)
@ -120,6 +123,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
*
* @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element
*
* @return array
*/
private function collectJoinTableColumnParameters(PersistentCollection $coll, $element)
@ -181,6 +185,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* {@inheritdoc}
*
* @override
*
* @internal Order of the parameters must be the same as the order of the columns in getDeleteSql.
*/
protected function getDeleteSQLParameters(PersistentCollection $coll)
@ -254,7 +259,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
/**
* @param \Doctrine\ORM\PersistentCollection $coll
* @param int $offset
* @param int $length
* @param int|null $length
*
* @return array
*/
public function slice(PersistentCollection $coll, $offset, $length = null)
@ -267,6 +273,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
/**
* @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element
*
* @return boolean
*/
public function contains(PersistentCollection $coll, $element)
@ -295,6 +302,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
/**
* @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element
*
* @return boolean
*/
public function removeElement(PersistentCollection $coll, $element)
@ -325,6 +333,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
* @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element
* @param boolean $addFilters Whether the filter SQL should be included or not.
*
* @return array
*/
private function getJoinTableRestrictions(PersistentCollection $coll, $element, $addFilters)

View File

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

View File

@ -147,6 +147,9 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL();
}
/**
* @return string
*/
protected function getSelectConditionDiscriminatorValueSQL()
{
$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
*
@ -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
*
* @return mixed
*
* @throws \RuntimeException
*/
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
*

View File

@ -42,7 +42,7 @@ class SqlValueVisitor extends ExpressionVisitor
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
*
@ -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
*
@ -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
*
@ -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
*/

View File

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

View File

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

View File

@ -27,7 +27,7 @@ namespace Doctrine\ORM\Proxy;
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
* 2. Remove namespace seperators from remaining class name.
@ -36,7 +36,10 @@ class Autoloader
* @param string $proxyDir
* @param string $proxyNamespace
* @param string $className
*
* @return string
*
* @throws ProxyException
*/
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.
*
* @param string $proxyDir
* @param string $proxyNamespace
* @param Closure $notFoundCallback Invoked when the proxy file is not found.
* @return Closure
* @param \Closure $notFoundCallback Invoked when the proxy file is not found.
*
* @return \Closure
*/
static public function register($proxyDir, $proxyNamespace, \Closure $notFoundCallback = null)
{
@ -75,4 +79,3 @@ class Autoloader
return $autoloader;
}
}

View File

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

View File

@ -20,27 +20,45 @@
namespace Doctrine\ORM\Proxy;
/**
* ORM Proxy Exception
* ORM Proxy Exception.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.com
* @since 1.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class ProxyException extends \Doctrine\ORM\ORMException {
public static function proxyDirectoryRequired() {
class ProxyException extends \Doctrine\ORM\ORMException
{
/**
* @return ProxyException
*/
public static function proxyDirectoryRequired()
{
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.");
}
public static function proxyNamespaceRequired() {
/**
* @return ProxyException
*/
public static function proxyNamespaceRequired()
{
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)
{
return new self(sprintf(
@ -48,5 +66,4 @@ class ProxyException extends \Doctrine\ORM\ORMException {
$className, $proxyNamespace
));
}
}

View File

@ -32,13 +32,32 @@ use Doctrine\Common\Util\ClassUtils;
*/
class ProxyFactory
{
/** The EntityManager this factory is bound to. */
/**
* The EntityManager this factory is bound to.
*
* @var \Doctrine\ORM\EntityManager
*/
private $_em;
/** Whether to automatically (re)generate proxy classes. */
/**
* Whether to automatically (re)generate proxy classes.
*
* @var bool
*/
private $_autoGenerate;
/** The namespace that contains all proxy classes. */
/**
* The namespace that contains all proxy classes.
*
* @var string
*/
private $_proxyNamespace;
/** The directory that contains all proxy classes. */
/**
* The directory that contains all proxy classes.
*
* @var string
*/
private $_proxyDir;
/**
@ -57,6 +76,8 @@ class ProxyFactory
* @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 boolean $autoGenerate Whether to automatically generate proxy classes.
*
* @throws ProxyException
*/
public function __construct(EntityManager $em, $proxyDir, $proxyNs, $autoGenerate = false)
{
@ -78,6 +99,7 @@ class ProxyFactory
*
* @param string $className
* @param mixed $identifier
*
* @return object
*/
public function getProxy($className, $identifier)
@ -98,10 +120,10 @@ class ProxyFactory
}
/**
* Generate the Proxy file name
* Generates the Proxy file name.
*
* @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
* EntityManager will be used by this factory.
* @return string
@ -117,9 +139,10 @@ class ProxyFactory
* Generates proxy classes for all given classes.
*
* @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
* by this factory is used.
*
* @return int Number of generated proxies.
*/
public function generateProxyClasses(array $classes, $toDir = null)
@ -146,9 +169,13 @@ class ProxyFactory
/**
* Generates a proxy class file.
*
* @param ClassMetadata $class Metadata for the original class
* @param string $fileName Filename (full path) for the generated class
* @param string $file The proxy class template data
* @param ClassMetadata $class Metadata for the original class.
* @param string $fileName Filename (full path) for the generated class.
* @param string $file The proxy class template data.
*
* @return void
*
* @throws ProxyException
*/
private function _generateProxyClass(ClassMetadata $class, $fileName, $file)
{
@ -198,6 +225,7 @@ class ProxyFactory
* Generates the methods of a proxy class.
*
* @param ClassMetadata $class
*
* @return string The code of the generated methods.
*/
private function _generateMethods(ClassMetadata $class)
@ -206,7 +234,7 @@ class ProxyFactory
$methodNames = array();
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()])) {
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,
* 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
* generate links to the entity, but do not display anything else).
*
* @param ReflectionMethod $method
* @param \ReflectionMethod $method
* @param ClassMetadata $class
*
* @return bool
*/
private function isShortIdentifierGetter($method, ClassMetadata $class)
@ -309,7 +338,8 @@ class ProxyFactory
/**
* Generates the code for the __sleep method for a proxy class.
*
* @param $class
* @param ClassMetadata $class
*
* @return string
*/
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.
*/
const STATE_CLEAN = 1;
/**
* 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
@ -49,6 +50,7 @@ final class Query extends AbstractQuery
const STATE_DIRTY = 2;
/* Query HINTS */
/**
* 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.
@ -57,7 +59,6 @@ final class Query extends AbstractQuery
*/
const HINT_REFRESH = 'doctrine.refresh';
/**
* 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
*/
const HINT_FORCE_PARTIAL_LOAD = 'doctrine.forcePartialLoad';
/**
* The includeMetaColumns query hint causes meta columns like foreign keys and
* 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';
/**
* @var integer $_state The current state of this query.
* The current state of this query.
*
* @var integer
*/
private $_state = self::STATE_CLEAN;
/**
* @var string $_dql Cached DQL query.
* Cached DQL query.
*
* @var string
*/
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;
/**
* @var integer The first result to return (the "offset").
* The first result to return (the "offset").
*
* @var integer
*/
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;
/**
* @var CacheDriver The cache driver used for caching queries.
* The cache driver used for caching queries.
*
* @var \Doctrine\Common\Cache\Cache|null
*/
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;
/**
* @var int Query Cache lifetime.
* The query cache lifetime.
*
* @var int
*/
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;
@ -171,6 +190,7 @@ final class Query extends AbstractQuery
* Gets the SQL query/queries that correspond to this DQL query.
*
* @return mixed The built sql query or an array of all sql queries.
*
* @override
*/
public function getSQL()
@ -265,10 +285,13 @@ final class Query extends AbstractQuery
}
/**
* Processes query parameter mappings
* Processes query parameter mappings.
*
* @param array $paramMappings
*
* @return array
*
* @throws Query\QueryException
*/
private function processParameterMappings($paramMappings)
{
@ -321,7 +344,8 @@ final class Query extends AbstractQuery
/**
* 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.
*/
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.
*
* @param boolean $bool
* @return @return Query This query instance.
*
* @return Query This query instance.
*/
public function useQueryCache($bool)
{
@ -347,7 +372,7 @@ final class Query extends AbstractQuery
/**
* 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.
*/
public function getQueryCacheDriver()
@ -362,7 +387,8 @@ final class Query extends AbstractQuery
/**
* 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.
*/
public function setQueryCacheLifetime($timeToLive)
@ -390,6 +416,7 @@ final class Query extends AbstractQuery
* Defines if the query cache is active or not.
*
* @param boolean $expire Whether or not to force query cache expiration.
*
* @return Query This query instance.
*/
public function expireQueryCache($expire = true)
@ -423,7 +450,8 @@ final class Query extends AbstractQuery
/**
* Sets a DQL query string.
*
* @param string $dqlQuery DQL Query
* @param string $dqlQuery DQL Query.
*
* @return \Doctrine\ORM\AbstractQuery
*/
public function setDQL($dqlQuery)
@ -439,7 +467,7 @@ final class Query extends AbstractQuery
/**
* Returns the DQL query that is represented by this query object.
*
* @return string DQL query
* @return string DQL query.
*/
public function getDQL()
{
@ -454,7 +482,7 @@ final class Query extends AbstractQuery
* @see AbstractQuery::STATE_CLEAN
* @see AbstractQuery::STATE_DIRTY
*
* @return integer Return the query state
* @return integer The query state.
*/
public function getState()
{
@ -464,7 +492,8 @@ final class Query extends AbstractQuery
/**
* 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
*/
public function contains($dql)
@ -476,6 +505,7 @@ final class Query extends AbstractQuery
* Sets the position of the first result to retrieve (the "offset").
*
* @param integer $firstResult The first result to return.
*
* @return Query This query object.
*/
public function setFirstResult($firstResult)
@ -501,6 +531,7 @@ final class Query extends AbstractQuery
* Sets the maximum number of results to retrieve (the "limit").
*
* @param integer $maxResults
*
* @return Query This query object.
*/
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
* 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.
*
* @return \Doctrine\ORM\Internal\Hydration\IterableResult
*/
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.
*
* @see \Doctrine\DBAL\LockMode
*
* @param int $lockMode
*
* @return Query
*
* @throws TransactionRequiredException
*/
public function setLockMode($lockMode)
{

View File

@ -26,6 +26,11 @@ use Doctrine\ORM\Query\QueryException;
*/
class ASTException extends QueryException
{
/**
* @param Node $node
*
* @return ASTException
*/
public static function noDispatchForNode($node)
{
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