commit
e319e34783
@ -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,11 +224,11 @@ abstract class AbstractQuery
|
||||
/**
|
||||
* Sets a query parameter.
|
||||
*
|
||||
* @param string|integer $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
|
||||
* the type conversion of this type. This is usually not needed for
|
||||
* strings and numeric types.
|
||||
* @param string|int $key The parameter position or name.
|
||||
* @param mixed $value The parameter value.
|
||||
* @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.
|
||||
*
|
||||
* @return \Doctrine\ORM\AbstractQuery This query instance.
|
||||
*/
|
||||
@ -241,10 +257,13 @@ abstract class AbstractQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an individual parameter value
|
||||
* Processes an individual parameter value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @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()
|
||||
@ -383,7 +409,8 @@ abstract class AbstractQuery
|
||||
*
|
||||
* @param boolean $bool
|
||||
* @param integer $lifetime
|
||||
* @param string $resultCacheId
|
||||
* @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)
|
||||
@ -464,9 +494,10 @@ abstract class AbstractQuery
|
||||
*
|
||||
* $fetchMode can be one of ClassMetadata::FETCH_EAGER or ClassMetadata::FETCH_LAZY
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $assocName
|
||||
* @param int $fetchMode
|
||||
* @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,9 +611,11 @@ 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.
|
||||
* @throws NoResultException If the query returned no result.
|
||||
*/
|
||||
public function getSingleResult($hydrationMode = null)
|
||||
{
|
||||
@ -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()
|
||||
@ -614,8 +653,9 @@ abstract class AbstractQuery
|
||||
/**
|
||||
* Sets a query hint. If the hint name is not recognized, it is silently ignored.
|
||||
*
|
||||
* @param string $name The name of the hint.
|
||||
* @param mixed $value The value of the hint.
|
||||
* @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()
|
||||
|
@ -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
|
||||
* @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)
|
||||
{
|
||||
@ -282,7 +305,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||
* Adds a named DQL query to the configuration.
|
||||
*
|
||||
* @param string $name The name of the query.
|
||||
* @param string $dql The DQL query string.
|
||||
* @param string $dql The DQL query string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addNamedQuery($name, $dql)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
@ -320,10 +349,12 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||
/**
|
||||
* Gets the components of a previously registered named native query.
|
||||
*
|
||||
* @param string $name The name of the query.
|
||||
* @param string $name The name of the query.
|
||||
*
|
||||
* @return array A tuple with the first element being the SQL string and the second
|
||||
* element being the ResultSetMapping.
|
||||
*
|
||||
* @throws ORMException
|
||||
* @return array A tuple with the first element being the SQL string and the second
|
||||
* element being the ResultSetMapping.
|
||||
*/
|
||||
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 $name The name of the filter.
|
||||
* @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,8 +658,8 @@ 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
|
||||
* SQLFilter instance or null of it is not defined.
|
||||
* @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()
|
||||
|
@ -123,8 +123,8 @@ class EntityManager implements ObjectManager
|
||||
* Creates a new EntityManager that operates on the given database connection
|
||||
* and uses the given Configuration and EventManager implementations.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $conn
|
||||
* @param \Doctrine\ORM\Configuration $config
|
||||
* @param \Doctrine\DBAL\Connection $conn
|
||||
* @param \Doctrine\ORM\Configuration $config
|
||||
* @param \Doctrine\Common\EventManager $eventManager
|
||||
*/
|
||||
protected function __construct(Connection $conn, Configuration $config, EventManager $eventManager)
|
||||
@ -193,6 +193,8 @@ class EntityManager implements ObjectManager
|
||||
|
||||
/**
|
||||
* Starts a transaction on the underlying database connection.
|
||||
*
|
||||
* @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)
|
||||
@ -300,8 +312,9 @@ class EntityManager implements ObjectManager
|
||||
/**
|
||||
* Creates a native SQL query.
|
||||
*
|
||||
* @param string $sql
|
||||
* @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.
|
||||
*/
|
||||
@ -359,12 +376,17 @@ class EntityManager implements ObjectManager
|
||||
/**
|
||||
* Finds an Entity by its identifier.
|
||||
*
|
||||
* @param string $entityName
|
||||
* @param mixed $id
|
||||
* @param string $entityName
|
||||
* @param mixed $id
|
||||
* @param integer $lockMode
|
||||
* @param integer $lockVersion
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @throws OptimisticLockException
|
||||
* @throws ORMInvalidArgumentException
|
||||
* @throws TransactionRequiredException
|
||||
* @throws ORMException
|
||||
*/
|
||||
public function find($entityName, $id, $lockMode = LockMode::NONE, $lockVersion = null)
|
||||
{
|
||||
@ -446,8 +468,11 @@ class EntityManager implements ObjectManager
|
||||
* without actually loading it, if the entity is not yet loaded.
|
||||
*
|
||||
* @param string $entityName The name of the entity type.
|
||||
* @param mixed $id The entity identifier.
|
||||
* @param mixed $id The entity identifier.
|
||||
*
|
||||
* @return object The entity reference.
|
||||
*
|
||||
* @throws ORMException
|
||||
*/
|
||||
public function getReference($entityName, $id)
|
||||
{
|
||||
@ -503,7 +528,8 @@ class EntityManager implements ObjectManager
|
||||
* never be loaded in the first place.
|
||||
*
|
||||
* @param string $entityName The name of the entity type.
|
||||
* @param mixed $identifier The entity identifier.
|
||||
* @param mixed $identifier The entity identifier.
|
||||
*
|
||||
* @return object The (partial) entity reference.
|
||||
*/
|
||||
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)
|
||||
{
|
||||
@ -650,8 +699,13 @@ 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.
|
||||
* @return object The new entity.
|
||||
* @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!
|
||||
*/
|
||||
@ -663,9 +717,12 @@ class EntityManager implements ObjectManager
|
||||
/**
|
||||
* Acquire a lock on the given entity.
|
||||
*
|
||||
* @param object $entity
|
||||
* @param int $lockMode
|
||||
* @param int $lockVersion
|
||||
* @param object $entity
|
||||
* @param int $lockMode
|
||||
* @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)
|
||||
@ -788,8 +850,11 @@ class EntityManager implements ObjectManager
|
||||
/**
|
||||
* Create a new instance for the given hydration mode.
|
||||
*
|
||||
* @param int $hydrationMode
|
||||
* @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 Configuration $config The Configuration instance to use.
|
||||
* @param EventManager $eventManager The EventManager instance to use.
|
||||
* @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()
|
||||
{
|
||||
|
@ -27,6 +27,9 @@ namespace Doctrine\ORM;
|
||||
*/
|
||||
class EntityNotFoundException extends ORMException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('Entity was not found.');
|
||||
|
@ -61,8 +61,8 @@ 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 EntityManager $em The EntityManager to use.
|
||||
* @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()
|
||||
{
|
||||
@ -137,9 +143,9 @@ 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 mixed $id The identifier.
|
||||
* @param int $lockMode The lock mode.
|
||||
* @param int|null $lockVersion The lock version.
|
||||
*
|
||||
* @return object The entity.
|
||||
*/
|
||||
@ -161,10 +167,11 @@ class EntityRepository implements ObjectRepository, Selectable
|
||||
/**
|
||||
* Finds entities by a set of criteria.
|
||||
*
|
||||
* @param array $criteria
|
||||
* @param array $criteria
|
||||
* @param array|null $orderBy
|
||||
* @param int|null $limit
|
||||
* @param int|null $offset
|
||||
* @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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,10 +44,10 @@ class LifecycleEventArgs extends EventArgs
|
||||
private $entity;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*
|
||||
* @param object $entity
|
||||
* @param \Doctrine\ORM\EntityManager $em
|
||||
* @param object $entity
|
||||
* @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
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -47,7 +47,7 @@ class PostFlushEventArgs extends EventArgs
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve associated EntityManager.
|
||||
* Retrieves associated EntityManager.
|
||||
*
|
||||
* @return \Doctrine\ORM\EntityManager
|
||||
*/
|
||||
|
@ -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;
|
||||
|
@ -40,9 +40,9 @@ class PreUpdateEventArgs extends LifecycleEventArgs
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param object $entity
|
||||
* @param \Doctrine\ORM\EntityManager $em
|
||||
* @param array $changeSet
|
||||
* @param object $entity
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
* @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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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).
|
||||
|
@ -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);
|
||||
|
@ -36,8 +36,13 @@ class AssignedGenerator extends AbstractIdGenerator
|
||||
/**
|
||||
* Returns the identifier assigned to the given entity.
|
||||
*
|
||||
* @param object $entity
|
||||
* @param EntityManager $em
|
||||
* @param object $entity
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
public function generate(EntityManager $em, $entity)
|
||||
|
@ -28,13 +28,19 @@ 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()
|
||||
* to obtain the last generated identifier within the current
|
||||
* database session/connection, if any.
|
||||
* 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.
|
||||
*/
|
||||
public function __construct($seqName = null)
|
||||
{
|
||||
|
@ -30,16 +30,34 @@ 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 string $sequenceName The name of the sequence.
|
||||
* @param integer $allocationSize The allocation size of the sequence.
|
||||
*/
|
||||
public function __construct($sequenceName, $allocationSize)
|
||||
@ -51,8 +69,11 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
|
||||
/**
|
||||
* Generates an ID for the given entity.
|
||||
*
|
||||
* @param object $entity
|
||||
* @return integer|float The generated value.
|
||||
* @param EntityManager $em
|
||||
* @param object $entity
|
||||
*
|
||||
* @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);
|
||||
|
@ -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) {
|
||||
|
@ -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 object $entity
|
||||
* @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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
*/
|
||||
@ -97,8 +125,9 @@ abstract class AbstractHydrator
|
||||
*
|
||||
* @param object $stmt
|
||||
* @param object $resultSetMapping
|
||||
* @param array $hints
|
||||
* @return mixed
|
||||
* @param array $hints
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
@ -162,9 +196,13 @@ abstract class AbstractHydrator
|
||||
*
|
||||
* Template method.
|
||||
*
|
||||
* @param array $data The row data.
|
||||
* @param array $cache The cache to use.
|
||||
* @param mixed $result The result to fill.
|
||||
* @param array $data The row data.
|
||||
* @param array $cache The cache to use.
|
||||
* @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,9 +411,11 @@ abstract class AbstractHydrator
|
||||
/**
|
||||
* Register entity as managed in UnitOfWork.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
|
||||
* @param object $entity
|
||||
* @param array $data
|
||||
* @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
|
||||
*/
|
||||
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -238,10 +264,12 @@ class ArrayHydrator extends AbstractHydrator
|
||||
* Updates the result pointer for an Entity. The result pointers point to the
|
||||
* last seen instance of each Entity type. This is used for graph construction.
|
||||
*
|
||||
* @param array $coll The element.
|
||||
* @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.
|
||||
* @param array $coll The element.
|
||||
* @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)
|
||||
{
|
||||
|
@ -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,10 +57,12 @@ class HydrationException extends \Doctrine\ORM\ORMException
|
||||
|
||||
/**
|
||||
* @since 2.3
|
||||
* @param string $entityName
|
||||
* @param string $discrColumnName
|
||||
* @param string $dqlAlias
|
||||
* @return HydrationException
|
||||
*
|
||||
* @param string $entityName
|
||||
* @param string $discrColumnName
|
||||
* @param string $dqlAlias
|
||||
*
|
||||
* @return HydrationException
|
||||
*/
|
||||
public static function missingDiscriminatorColumn($entityName, $discrColumnName, $dqlAlias)
|
||||
{
|
||||
@ -58,10 +74,12 @@ class HydrationException extends \Doctrine\ORM\ORMException
|
||||
|
||||
/**
|
||||
* @since 2.3
|
||||
* @param string $entityName
|
||||
* @param string $discrColumnName
|
||||
* @param string $dqlAlias
|
||||
* @return HydrationException
|
||||
*
|
||||
* @param string $entityName
|
||||
* @param string $discrColumnName
|
||||
* @param string $dqlAlias
|
||||
*
|
||||
* @return HydrationException
|
||||
*/
|
||||
public static function missingDiscriminatorMetaMappingColumn($entityName, $discrColumnName, $dqlAlias)
|
||||
{
|
||||
@ -70,4 +88,4 @@ class HydrationException extends \Doctrine\ORM\ORMException
|
||||
$discrColumnName, $entityName, $dqlAlias
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
namespace Doctrine\ORM\Internal\Hydration;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Doctrine\ORM\NonUniqueResultException;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
|
||||
*/
|
||||
final class AttributeOverride implements Annotation
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the property whose mapping is being overridden.
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -34,19 +34,19 @@ class AssociationBuilder
|
||||
protected $mapping;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array|null
|
||||
*/
|
||||
protected $joinColumns;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* @param ClassMetadataBuilder $builder
|
||||
* @param array $mapping
|
||||
* @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 $columnName
|
||||
* @param string $referencedColumnName
|
||||
* @param bool $nullable
|
||||
* @param bool $unique
|
||||
* @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()
|
||||
{
|
||||
|
@ -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 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 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
|
||||
* @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 $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|null $inversedBy
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $targetEntity
|
||||
* @param string $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 $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)
|
||||
|
@ -33,10 +33,12 @@ class FieldBuilder
|
||||
* @var ClassMetadataBuilder
|
||||
*/
|
||||
private $builder;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $mapping;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@ -53,9 +55,8 @@ class FieldBuilder
|
||||
private $sequenceDef;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ClassMetadataBuilder $builder
|
||||
* @param array $mapping
|
||||
* @param array $mapping
|
||||
*/
|
||||
public function __construct(ClassMetadataBuilder $builder, 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
|
||||
*
|
||||
* @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
|
||||
* @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.
|
||||
*
|
||||
|
@ -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 $columnName
|
||||
* @param string $referencedColumnName
|
||||
* @param bool $nullable
|
||||
* @param bool $unique
|
||||
* @param string|null $onDelete
|
||||
* @param string|null $columnDef
|
||||
*
|
||||
* @return ManyToManyAssociationBuilder
|
||||
*/
|
||||
public function addInverseJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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"})
|
||||
*/
|
||||
|
@ -173,8 +173,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
|
||||
/**
|
||||
* Validate runtime metadata is correctly defined.
|
||||
*
|
||||
* @param ClassMetadata $class
|
||||
* @param $parent
|
||||
* @param ClassMetadata $class
|
||||
* @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)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
|
||||
*/
|
||||
final class CustomIdGenerator implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $class;
|
||||
}
|
||||
|
@ -136,5 +136,4 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||
|
||||
return $platform->getSQLResultCasing($columnName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
|
||||
*/
|
||||
final class DiscriminatorMap implements Annotation
|
||||
{
|
||||
/** @var array<string> */
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
|
@ -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,10 +488,11 @@ class AnnotationDriver extends AbstractAnnotationDriver
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given JoinColumn as array
|
||||
* Parses the given JoinColumn as array.
|
||||
*
|
||||
* @param JoinColumn $joinColumn
|
||||
* @return array
|
||||
* @param JoinColumn $joinColumn
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function joinColumnToArray(JoinColumn $joinColumn)
|
||||
{
|
||||
@ -506,9 +509,10 @@ class AnnotationDriver extends AbstractAnnotationDriver
|
||||
/**
|
||||
* Parse the given Column as array
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param Column $column
|
||||
* @return array
|
||||
* @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|null $reader
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @param AnnotationReader $reader
|
||||
* @return AnnotationDriver
|
||||
*/
|
||||
static public function create($paths = array(), AnnotationReader $reader = null)
|
||||
|
@ -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)
|
||||
@ -382,9 +392,10 @@ class DatabaseDriver implements MappingDriver
|
||||
/**
|
||||
* Return the mapped field name for a column, if it exists. Otherwise return camelized version.
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param string $columnName
|
||||
* @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)
|
||||
|
@ -28,4 +28,4 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
|
||||
*/
|
||||
class DriverChain extends MappingDriverChain
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -28,4 +28,4 @@ use Doctrine\Common\Persistence\Mapping\Driver\PHPDriver as CommonPHPDriver;
|
||||
*/
|
||||
class PHPDriver extends CommonPHPDriver
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -28,4 +28,4 @@ use Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver as CommonStaticPH
|
||||
*/
|
||||
class StaticPHPDriver extends CommonStaticPHPDriver
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -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,10 +624,11 @@ class XmlDriver extends FileDriver
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given field as array
|
||||
* Parses the given field as array.
|
||||
*
|
||||
* @param SimpleXMLElement $fieldMapping
|
||||
* @return 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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param array $column
|
||||
* @return array
|
||||
*/
|
||||
private function columnToArray($fieldName, $column)
|
||||
|
@ -26,6 +26,8 @@ namespace Doctrine\ORM\Mapping;
|
||||
*/
|
||||
final class ElementCollection implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $tableName;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
|
||||
*/
|
||||
final class FieldResult implements Annotation
|
||||
{
|
||||
|
||||
/**
|
||||
* Name of the column in the SELECT clause.
|
||||
*
|
||||
@ -39,10 +38,9 @@ final class FieldResult implements Annotation
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Name of the persistent field or property of the class.
|
||||
* Name of the persistent field or property of the class.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $column;
|
||||
|
||||
}
|
||||
|
@ -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"})
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"})
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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"})
|
||||
*/
|
||||
|
@ -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"})
|
||||
*/
|
||||
|
@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
|
||||
*/
|
||||
final class MappedSuperclass implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $repositoryClass;
|
||||
}
|
||||
|
@ -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,41 +56,73 @@ 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'.");
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 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 $hint Can optionally be used to supply a tip for common mistakes,
|
||||
* e.g. "Did you think of the plural s?"
|
||||
* @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)
|
||||
{
|
||||
@ -190,20 +297,33 @@ class MappingException extends \Doctrine\ORM\ORMException
|
||||
* because there might be long classnames that will be shortened
|
||||
* within the stacktrace
|
||||
*
|
||||
* @param string $entity The entity's name
|
||||
* @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 $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,46 +480,87 @@ 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.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $columnName
|
||||
* @return self
|
||||
* @param string $className
|
||||
* @param string $columnName
|
||||
*
|
||||
* @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));
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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"})
|
||||
*/
|
||||
|
@ -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"})
|
||||
*/
|
||||
|
@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
|
||||
*/
|
||||
final class OrderBy implements Annotation
|
||||
{
|
||||
/** @var array<string> */
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
public $value;
|
||||
}
|
||||
|
@ -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>
|
||||
@ -33,80 +33,88 @@ interface QuoteStrategy
|
||||
/**
|
||||
* Gets the (possibly quoted) column name for safe use in an SQL statement.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
* @return string
|
||||
* @param string $fieldName
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) primary table name for safe use in an SQL statement.
|
||||
*
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
* @return string
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getTableName(ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) sequence name for safe use in an SQL statement.
|
||||
*
|
||||
* @param array $definition
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
* @return string
|
||||
* @param array $definition
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) name of the join table.
|
||||
*
|
||||
* @param array $association
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
* @return string
|
||||
* @param array $association
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) join column name.
|
||||
*
|
||||
* @param array $joinColumn
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
* @return string
|
||||
* @param array $joinColumn
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) join column name.
|
||||
*
|
||||
* @param array $joinColumn
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
* @return string
|
||||
* @param array $joinColumn
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
|
||||
*
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
* @return array
|
||||
* @param ClassMetadata $class
|
||||
* @param AbstractPlatform $platform
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
|
||||
|
||||
/**
|
||||
* Gets the column alias.
|
||||
*
|
||||
* @param string $columnName
|
||||
* @param integer $counter
|
||||
* @param AbstractPlatform $platform
|
||||
* @param ClassMetadata $class
|
||||
* @return string
|
||||
* @param string $columnName
|
||||
* @param integer $counter
|
||||
* @param AbstractPlatform $platform
|
||||
* @param ClassMetadata|null $class
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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.');
|
||||
|
@ -27,5 +27,4 @@ namespace Doctrine\ORM;
|
||||
*/
|
||||
class NonUniqueResultException extends UnexpectedResultException
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -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.");
|
||||
|
@ -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 .
|
||||
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.");
|
||||
@ -116,7 +190,8 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
|
||||
/**
|
||||
* Helper method to show an object as string.
|
||||
*
|
||||
* @param object $obj
|
||||
* @param object $obj
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function objToStr($obj)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
@ -115,9 +116,9 @@ final class PersistentCollection implements Collection, Selectable
|
||||
/**
|
||||
* Creates a new persistent collection.
|
||||
*
|
||||
* @param EntityManager $em The EntityManager the collection will be associated with.
|
||||
* @param EntityManager $em The EntityManager the collection will be associated with.
|
||||
* @param ClassMetadata $class The class descriptor of the entity type of this collection.
|
||||
* @param 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)
|
||||
{
|
||||
@ -186,8 +194,10 @@ final class PersistentCollection implements Collection, Selectable
|
||||
* INTERNAL:
|
||||
* 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 $key The key 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 $offset
|
||||
* @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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
* @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
|
||||
* @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
|
||||
* @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
|
||||
* @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
|
||||
* @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
|
||||
* @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);
|
||||
|
||||
@ -256,7 +285,9 @@ abstract class AbstractCollectionPersister
|
||||
* element from the given collection.
|
||||
*
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param mixed $element
|
||||
* @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);
|
||||
|
||||
@ -279,7 +314,9 @@ abstract class AbstractCollectionPersister
|
||||
* element of the given collection into the database.
|
||||
*
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param mixed $element
|
||||
* @param mixed $element
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function getInsertRowSQLParameters(PersistentCollection $coll, $element);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
*/
|
||||
@ -207,7 +209,7 @@ class BasicEntityPersister
|
||||
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
|
||||
* and persists instances of the class described by the given ClassMetadata descriptor.
|
||||
*
|
||||
* @param \Doctrine\ORM\EntityManager $em
|
||||
* @param \Doctrine\ORM\EntityManager $em
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
|
||||
*/
|
||||
public function __construct(EntityManager $em, ClassMetadata $class)
|
||||
@ -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)
|
||||
{
|
||||
@ -297,7 +301,9 @@ class BasicEntityPersister
|
||||
* entities version field.
|
||||
*
|
||||
* @param object $entity
|
||||
* @param mixed $id
|
||||
* @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
|
||||
* @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)
|
||||
{
|
||||
@ -369,10 +378,15 @@ class BasicEntityPersister
|
||||
* Performs an UPDATE statement for an entity on a specific table.
|
||||
* The UPDATE can optionally be versioned, which requires the entity to have a version field.
|
||||
*
|
||||
* @param object $entity The entity object being updated.
|
||||
* @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.
|
||||
* @param object $entity The entity object being updated.
|
||||
* @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)
|
||||
@ -684,15 +706,16 @@ 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 array $hints Hints for entity creation.
|
||||
* @param int $lockMode
|
||||
* @param int $limit Limit number of results
|
||||
* @param array $orderBy Criteria to order by
|
||||
* @param array $criteria The criteria by which to load the entity.
|
||||
* @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|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)
|
||||
@ -716,12 +739,15 @@ class BasicEntityPersister
|
||||
* Loads an entity of this persister's mapped class as part of a single-valued
|
||||
* association from another entity.
|
||||
*
|
||||
* @param array $assoc The association to load.
|
||||
* @param array $assoc The association to load.
|
||||
* @param object $sourceEntity The entity that owns the association (not necessarily the "owning side").
|
||||
* @param 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.
|
||||
* @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())
|
||||
{
|
||||
@ -789,9 +815,12 @@ class BasicEntityPersister
|
||||
/**
|
||||
* Refreshes a managed entity.
|
||||
*
|
||||
* @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 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
|
||||
@ -864,10 +893,11 @@ 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 $criteria
|
||||
* @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 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,9 +929,9 @@ class BasicEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an array of entities from a given dbal statement.
|
||||
* Loads an array of entities from a given DBAL statement.
|
||||
*
|
||||
* @param array $assoc
|
||||
* @param array $assoc
|
||||
* @param \Doctrine\DBAL\Statement $stmt
|
||||
*
|
||||
* @return array
|
||||
@ -919,11 +950,11 @@ class BasicEntityPersister
|
||||
}
|
||||
|
||||
/**
|
||||
* Hydrate a collection from a given dbal statement.
|
||||
* Hydrates a collection from a given DBAL statement.
|
||||
*
|
||||
* @param array $assoc
|
||||
* @param array $assoc
|
||||
* @param \Doctrine\DBAL\Statement $stmt
|
||||
* @param PersistentCollection $coll
|
||||
* @param PersistentCollection $coll
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -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 object $sourceEntity The entity that owns the collection.
|
||||
* @param PersistentCollection $coll The collection to fill.
|
||||
* @param int|null $offset
|
||||
* @param int|null $limit
|
||||
* @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.
|
||||
*
|
||||
* @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 int $lockMode
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @param array $orderBy
|
||||
* @param array|null $assoc
|
||||
* @param int $lockMode
|
||||
* @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)
|
||||
@ -1089,9 +1129,12 @@ class BasicEntityPersister
|
||||
/**
|
||||
* Gets the ORDER BY SQL snippet for ordered collections.
|
||||
*
|
||||
* @param array $orderBy
|
||||
* @param array $orderBy
|
||||
* @param string $baseTableAlias
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
*/
|
||||
protected final function getOrderBySQL(array $orderBy, $baseTableAlias)
|
||||
{
|
||||
@ -1235,10 +1278,10 @@ class BasicEntityPersister
|
||||
/**
|
||||
* Gets the SQL join fragment used when selecting entities from an association.
|
||||
*
|
||||
* @param string $field
|
||||
* @param array $assoc
|
||||
* @param string $field
|
||||
* @param array $assoc
|
||||
* @param ClassMetadata $class
|
||||
* @param string $alias
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -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)
|
||||
@ -1381,10 +1425,12 @@ class BasicEntityPersister
|
||||
/**
|
||||
* Gets the SQL snippet of a qualified column name for the given field name.
|
||||
*
|
||||
* @param string $field The field name.
|
||||
* @param string $field The field name.
|
||||
* @param ClassMetadata $class The class that declares this field. The table this class is
|
||||
* mapped to must own the column for the given field.
|
||||
* @param string $alias
|
||||
* @param string $alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r')
|
||||
{
|
||||
@ -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
|
||||
* @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 $field
|
||||
* @param mixed $value
|
||||
* @param array|null $assoc
|
||||
* @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 string $field
|
||||
* @param array|null $assoc
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
*/
|
||||
protected function getSelectConditionStatementColumnSQL($field, $assoc = null)
|
||||
{
|
||||
@ -1578,8 +1631,9 @@ class BasicEntityPersister
|
||||
* Subclasses are supposed to override this method if they intend to change
|
||||
* or alter the criteria by which entities are selected.
|
||||
*
|
||||
* @param array $criteria
|
||||
* @param AssociationMapping $assoc
|
||||
* @param array $criteria
|
||||
* @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|null $offset
|
||||
* @param int|null $limit
|
||||
*
|
||||
* @param array $assoc
|
||||
* @param object $sourceEntity
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @return array
|
||||
*/
|
||||
public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null)
|
||||
@ -1612,11 +1667,11 @@ class BasicEntityPersister
|
||||
/**
|
||||
* Loads a collection of entities in a one-to-many association.
|
||||
*
|
||||
* @param array $assoc
|
||||
* @param object $sourceEntity
|
||||
* @param PersistentCollection $coll The collection to load/fill.
|
||||
* @param int|null $offset
|
||||
* @param int|null $limit
|
||||
* @param array $assoc
|
||||
* @param object $sourceEntity
|
||||
* @param PersistentCollection $coll The collection to load/fill.
|
||||
*
|
||||
* @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 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
|
||||
*
|
||||
* @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
|
||||
* @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)
|
||||
@ -1842,8 +1908,8 @@ class BasicEntityPersister
|
||||
/**
|
||||
* Generates the filter SQL for a given entity and table alias.
|
||||
*
|
||||
* @param ClassMetadata $targetEntity Metadata of the target entity.
|
||||
* @param string $targetTableAlias The table alias of the joined/selected table.
|
||||
* @param ClassMetadata $targetEntity Metadata of the target entity.
|
||||
* @param string $targetTableAlias The table alias of the joined/selected table.
|
||||
*
|
||||
* @return string The SQL query part to add to a query.
|
||||
*/
|
||||
|
@ -26,5 +26,4 @@ namespace Doctrine\ORM\Persisters;
|
||||
*/
|
||||
abstract class ElementCollectionPersister extends AbstractCollectionPersister
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
@ -70,7 +71,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
*
|
||||
* @throws \BadMethodCallException Not used for OneToManyPersister
|
||||
*/
|
||||
protected function getUpdateRowSQL(PersistentCollection $coll)
|
||||
@ -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)
|
||||
@ -119,7 +122,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
* of the join table columns as specified in ManyToManyMapping#joinTableColumns.
|
||||
*
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param object $element
|
||||
* @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)
|
||||
@ -253,8 +258,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param int $offset
|
||||
* @param int $length
|
||||
* @param int $offset
|
||||
* @param int|null $length
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function slice(PersistentCollection $coll, $offset, $length = null)
|
||||
@ -266,7 +272,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param object $element
|
||||
* @param object $element
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function contains(PersistentCollection $coll, $element)
|
||||
@ -294,7 +301,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param object $element
|
||||
* @param object $element
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function removeElement(PersistentCollection $coll, $element)
|
||||
@ -323,8 +331,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param object $element
|
||||
* @param boolean $addFilters Whether the filter SQL should be included or not.
|
||||
* @param object $element
|
||||
* @param boolean $addFilters Whether the filter SQL should be included or not.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getJoinTableRestrictions(PersistentCollection $coll, $element, $addFilters)
|
||||
@ -431,8 +440,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
/**
|
||||
* Generates the filter SQL for a given entity and table alias.
|
||||
*
|
||||
* @param ClassMetadata $targetEntity Metadata of the target entity.
|
||||
* @param string $targetTableAlias The table alias of the joined/selected table.
|
||||
* @param ClassMetadata $targetEntity Metadata of the target entity.
|
||||
* @param string $targetTableAlias The table alias of the joined/selected table.
|
||||
*
|
||||
* @return string The SQL query part to add to a query.
|
||||
*/
|
||||
|
@ -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)
|
||||
{
|
||||
@ -70,8 +73,8 @@ 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)
|
||||
{
|
||||
@ -146,8 +149,9 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param int $offset
|
||||
* @param int $length
|
||||
* @param int $offset
|
||||
* @param int|null $length
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function slice(PersistentCollection $coll, $offset, $length = null)
|
||||
@ -161,7 +165,8 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param object $element
|
||||
* @param object $element
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function contains(PersistentCollection $coll, $element)
|
||||
@ -193,7 +198,8 @@ class OneToManyPersister extends AbstractCollectionPersister
|
||||
|
||||
/**
|
||||
* @param \Doctrine\ORM\PersistentCollection $coll
|
||||
* @param object $element
|
||||
* @param object $element
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function removeElement(PersistentCollection $coll, $element)
|
||||
|
@ -147,6 +147,9 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
|
||||
return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getSelectConditionDiscriminatorValueSQL()
|
||||
{
|
||||
$values = array();
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -21,5 +21,4 @@ namespace Doctrine\ORM\Persisters;
|
||||
|
||||
class UnionSubclassPersister extends BasicEntityPersister
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,9 @@ namespace Doctrine\ORM;
|
||||
*/
|
||||
class PessimisticLockException extends ORMException
|
||||
{
|
||||
/**
|
||||
* @return PessimisticLockException
|
||||
*/
|
||||
public static function lockFailed()
|
||||
{
|
||||
return new self("The pessimistic lock failed.");
|
||||
|
@ -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 string $proxyDir
|
||||
* @param string $proxyNamespace
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
}
|
||||
|
@ -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
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user