1
0
mirror of synced 2024-12-05 03:06:05 +03:00

Fixed unused 'use' statements.

Fixed missed documentation issues in Doctrine\ORM
This commit is contained in:
Benjamin Morel 2012-12-13 17:56:25 +00:00
parent ba16789843
commit 7869ec714d
14 changed files with 140 additions and 71 deletions

View File

@ -42,18 +42,22 @@ use Doctrine\ORM\ORMInvalidArgumentException;
abstract class AbstractQuery abstract class AbstractQuery
{ {
/* Hydration mode constants */ /* Hydration mode constants */
/** /**
* Hydrates an object graph. This is the default behavior. * Hydrates an object graph. This is the default behavior.
*/ */
const HYDRATE_OBJECT = 1; const HYDRATE_OBJECT = 1;
/** /**
* Hydrates an array graph. * Hydrates an array graph.
*/ */
const HYDRATE_ARRAY = 2; const HYDRATE_ARRAY = 2;
/** /**
* Hydrates a flat, rectangular result set with scalar values. * Hydrates a flat, rectangular result set with scalar values.
*/ */
const HYDRATE_SCALAR = 3; const HYDRATE_SCALAR = 3;
/** /**
* Hydrates a single scalar value. * Hydrates a single scalar value.
*/ */
@ -65,27 +69,37 @@ abstract class AbstractQuery
const HYDRATE_SIMPLEOBJECT = 5; const HYDRATE_SIMPLEOBJECT = 5;
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection The parameter map of this query. * The parameter map of this query.
*
* @var \Doctrine\Common\Collections\ArrayCollection
*/ */
protected $parameters; protected $parameters;
/** /**
* @var \Doctrine\ORM\Query\ResultSetMapping The user-specified ResultSetMapping to use. * The user-specified ResultSetMapping to use.
*
* @var \Doctrine\ORM\Query\ResultSetMapping
*/ */
protected $_resultSetMapping; protected $_resultSetMapping;
/** /**
* @var \Doctrine\ORM\EntityManager The entity manager used by this query object. * The entity manager used by this query object.
*
* @var \Doctrine\ORM\EntityManager
*/ */
protected $_em; protected $_em;
/** /**
* @var array The map of query hints. * The map of query hints.
*
* @var array
*/ */
protected $_hints = array(); protected $_hints = array();
/** /**
* @var integer The hydration mode. * The hydration mode.
*
* @var integer
*/ */
protected $_hydrationMode = self::HYDRATE_OBJECT; protected $_hydrationMode = self::HYDRATE_OBJECT;
@ -95,7 +109,9 @@ abstract class AbstractQuery
protected $_queryCacheProfile; protected $_queryCacheProfile;
/** /**
* @var boolean Boolean value that indicates whether or not expire the result cache. * Whether or not expire the result cache.
*
* @var boolean
*/ */
protected $_expireResultCache = false; protected $_expireResultCache = false;

View File

@ -135,7 +135,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Add a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader * Adds a new default annotation driver with a correctly configured annotation reader. If $useSimpleAnnotationReader
* is true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported. * is true, the notation `@Entity` will work, otherwise, the notation `@ORM\Entity` will be supported.
* *
* @param array $paths * @param array $paths
@ -564,7 +564,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set the custom hydrator modes in one pass. * Sets the custom hydrator modes in one pass.
* *
* @param array $modes An array of ($modeName => $hydrator). * @param array $modes An array of ($modeName => $hydrator).
* *
@ -580,7 +580,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Get the hydrator class for the given hydration mode name. * Gets the hydrator class for the given hydration mode name.
* *
* @param string $modeName The hydration mode name. * @param string $modeName The hydration mode name.
* *
@ -594,7 +594,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Add a custom hydration mode. * Adds a custom hydration mode.
* *
* @param string $modeName The hydration mode name. * @param string $modeName The hydration mode name.
* @param string $hydrator The hydrator class name. * @param string $hydrator The hydrator class name.
@ -607,7 +607,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set a class metadata factory. * Sets a class metadata factory.
* *
* @param string $cmfName * @param string $cmfName
* *
@ -631,7 +631,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Add a filter to the list of possible filters. * Adds a filter to the list of possible filters.
* *
* @param string $name The name of the filter. * @param string $name The name of the filter.
* @param string|Query\Filter\SQLFilter $filter The filter class name or an SQLFilter instance. * @param string|Query\Filter\SQLFilter $filter The filter class name or an SQLFilter instance.
@ -669,7 +669,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set default repository class. * Sets default repository class.
* *
* @since 2.2 * @since 2.2
* *
@ -705,7 +705,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set naming strategy. * Sets naming strategy.
* *
* @since 2.3 * @since 2.3
* *
@ -719,7 +719,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Get naming strategy.. * Gets naming strategy..
* *
* @since 2.3 * @since 2.3
* *
@ -735,7 +735,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Set quote strategy. * Sets quote strategy.
* *
* @since 2.3 * @since 2.3
* *
@ -749,7 +749,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
} }
/** /**
* Get quote strategy. * Gets quote strategy.
* *
* @since 2.3 * @since 2.3
* *

View File

@ -268,6 +268,8 @@ class EntityManager implements ObjectManager
* MyProject\Domain\User * MyProject\Domain\User
* sales:PriceRequest * sales:PriceRequest
* *
* @param string $className
*
* @return \Doctrine\ORM\Mapping\ClassMetadata * @return \Doctrine\ORM\Mapping\ClassMetadata
* *
* @internal Performance-sensitive method. * @internal Performance-sensitive method.
@ -359,6 +361,8 @@ class EntityManager implements ObjectManager
* *
* @param object $entity * @param object $entity
* *
* @return void
*
* @throws \Doctrine\ORM\OptimisticLockException If a version check on an entity that * @throws \Doctrine\ORM\OptimisticLockException If a version check on an entity that
* makes use of optimistic locking fails. * makes use of optimistic locking fails.
*/ */

View File

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

View File

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

View File

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

View File

@ -27,6 +27,9 @@ namespace Doctrine\ORM;
*/ */
final class NativeQuery extends AbstractQuery final class NativeQuery extends AbstractQuery
{ {
/**
* @var string
*/
private $_sql; private $_sql;
/** /**

View File

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

View File

@ -50,6 +50,7 @@ final class Query extends AbstractQuery
const STATE_DIRTY = 2; const STATE_DIRTY = 2;
/* Query HINTS */ /* Query HINTS */
/** /**
* The refresh hint turns any query into a refresh query with the result that * The refresh hint turns any query into a refresh query with the result that
* any local changes in entities are overridden with the fetched values. * any local changes in entities are overridden with the fetched values.
@ -113,47 +114,65 @@ final class Query extends AbstractQuery
const HINT_LOCK_MODE = 'doctrine.lockMode'; const HINT_LOCK_MODE = 'doctrine.lockMode';
/** /**
* @var integer $_state The current state of this query. * The current state of this query.
*
* @var integer
*/ */
private $_state = self::STATE_CLEAN; private $_state = self::STATE_CLEAN;
/** /**
* @var string $_dql Cached DQL query. * Cached DQL query.
*
* @var string
*/ */
private $_dql = null; private $_dql = null;
/** /**
* @var \Doctrine\ORM\Query\ParserResult The parser result that holds DQL => SQL information. * The parser result that holds DQL => SQL information.
*
* @var \Doctrine\ORM\Query\ParserResult
*/ */
private $_parserResult; private $_parserResult;
/** /**
* @var integer The first result to return (the "offset"). * The first result to return (the "offset").
*
* @var integer
*/ */
private $_firstResult = null; private $_firstResult = null;
/** /**
* @var integer The maximum number of results to return (the "limit"). * The maximum number of results to return (the "limit").
*
* @var integer
*/ */
private $_maxResults = null; private $_maxResults = null;
/** /**
* @var CacheDriver The cache driver used for caching queries. * The cache driver used for caching queries.
*
* @var \Doctrine\Common\Cache\Cache|null
*/ */
private $_queryCache; private $_queryCache;
/** /**
* @var boolean Boolean value that indicates whether or not expire the query cache. * Whether or not expire the query cache.
*
* @var boolean
*/ */
private $_expireQueryCache = false; private $_expireQueryCache = false;
/** /**
* @var int Query Cache lifetime. * The query cache lifetime.
*
* @var int
*/ */
private $_queryCacheTTL; private $_queryCacheTTL;
/** /**
* @var boolean Whether to use a query cache, if available. Defaults to TRUE. * Whether to use a query cache, if available. Defaults to TRUE.
*
* @var boolean
*/ */
private $_useQueryCache = true; private $_useQueryCache = true;
@ -325,7 +344,7 @@ final class Query extends AbstractQuery
/** /**
* Defines a cache driver to be used for caching queries. * Defines a cache driver to be used for caching queries.
* *
* @param Doctrine_Cache_Interface|null $queryCache Cache driver. * @param \Doctrine\Common\Cache\Cache|null $queryCache Cache driver.
* *
* @return Query This query instance. * @return Query This query instance.
*/ */
@ -353,8 +372,8 @@ final class Query extends AbstractQuery
/** /**
* Returns the cache driver used for query caching. * Returns the cache driver used for query caching.
* *
* @return CacheDriver The cache driver used for query caching or NULL, if * @return \Doctrine\Common\Cache\Cache|null The cache driver used for query caching or NULL, if
* this Query does not use query caching. * this Query does not use query caching.
*/ */
public function getQueryCacheDriver() public function getQueryCacheDriver()
{ {

View File

@ -41,17 +41,21 @@ class QueryBuilder
const DELETE = 1; const DELETE = 1;
const UPDATE = 2; const UPDATE = 2;
/** The builder states. */ /* The builder states. */
const STATE_DIRTY = 0; const STATE_DIRTY = 0;
const STATE_CLEAN = 1; const STATE_CLEAN = 1;
/** /**
* @var EntityManager The EntityManager used by this QueryBuilder. * The EntityManager used by this QueryBuilder.
*
* @var EntityManager
*/ */
private $_em; private $_em;
/** /**
* @var array The array of DQL parts collected. * The array of DQL parts collected.
*
* @var array
*/ */
private $_dqlParts = array( private $_dqlParts = array(
'distinct' => false, 'distinct' => false,
@ -66,37 +70,51 @@ class QueryBuilder
); );
/** /**
* @var integer The type of query this is. Can be select, update or delete. * The type of query this is. Can be select, update or delete.
*
* @var integer
*/ */
private $_type = self::SELECT; private $_type = self::SELECT;
/** /**
* @var integer The state of the query object. Can be dirty or clean. * The state of the query object. Can be dirty or clean.
*
* @var integer
*/ */
private $_state = self::STATE_CLEAN; private $_state = self::STATE_CLEAN;
/** /**
* @var string The complete DQL string for this query. * The complete DQL string for this query.
*
* @var string
*/ */
private $_dql; private $_dql;
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection The query parameters. * The query parameters.
*
* @var \Doctrine\Common\Collections\ArrayCollection
*/ */
private $parameters = array(); private $parameters = array();
/** /**
* @var integer The index of the first result to retrieve. * The index of the first result to retrieve.
*
* @var integer
*/ */
private $_firstResult = null; private $_firstResult = null;
/** /**
* @var integer The maximum number of results to retrieve. * The maximum number of results to retrieve.
*
* @var integer
*/ */
private $_maxResults = null; private $_maxResults = null;
/** /**
* @var array Keeps root entity alias names for join entities. * Keeps root entity alias names for join entities.
*
* @var array
*/ */
private $joinRootAliases = array(); private $joinRootAliases = array();
@ -133,7 +151,7 @@ class QueryBuilder
} }
/** /**
* Get the type of the currently built query. * Gets the type of the currently built query.
* *
* @return integer * @return integer
*/ */
@ -143,7 +161,7 @@ class QueryBuilder
} }
/** /**
* Get the associated EntityManager for this query builder. * Gets the associated EntityManager for this query builder.
* *
* @return EntityManager * @return EntityManager
*/ */
@ -153,7 +171,7 @@ class QueryBuilder
} }
/** /**
* Get the state of this query builder instance. * Gets the state of this query builder instance.
* *
* @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN. * @return integer Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
*/ */
@ -163,7 +181,7 @@ class QueryBuilder
} }
/** /**
* Get the complete DQL string formed by the current specifications of this QueryBuilder. * Gets the complete DQL string formed by the current specifications of this QueryBuilder.
* *
* <code> * <code>
* $qb = $em->createQueryBuilder() * $qb = $em->createQueryBuilder()
@ -576,7 +594,7 @@ class QueryBuilder
} }
/** /**
* Add a DISTINCT flag to this query. * Adds a DISTINCT flag to this query.
* *
* <code> * <code>
* $qb = $em->createQueryBuilder() * $qb = $em->createQueryBuilder()
@ -679,7 +697,7 @@ class QueryBuilder
} }
/** /**
* Create and add a query root corresponding to the entity identified by the given alias, * Creates and adds a query root corresponding to the entity identified by the given alias,
* forming a cartesian product with any existing query roots. * forming a cartesian product with any existing query roots.
* *
* <code> * <code>
@ -1049,10 +1067,11 @@ class QueryBuilder
} }
/** /**
* Add criteria to query. * Adds criteria to the query.
* Add where expressions with AND operator. *
* Add orderings. * Adds where expressions with AND operator.
* Override firstResult and maxResults if they set. * Adds orderings.
* Overrides firstResult and maxResults if they're set.
* *
* @param Criteria $criteria * @param Criteria $criteria
* *
@ -1087,7 +1106,7 @@ class QueryBuilder
} }
/** /**
* Get a query part by its name. * Gets a query part by its name.
* *
* @param string $queryPartName * @param string $queryPartName
* *
@ -1101,7 +1120,7 @@ class QueryBuilder
} }
/** /**
* Get all query parts. * Gets all query parts.
* *
* @return array $dqlParts * @return array $dqlParts
* *
@ -1194,7 +1213,7 @@ class QueryBuilder
} }
/** /**
* Reset DQL parts * Resets DQL parts.
* *
* @param array|null $parts * @param array|null $parts
* *
@ -1214,7 +1233,7 @@ class QueryBuilder
} }
/** /**
* Reset single DQL part * Resets single DQL part.
* *
* @param string $part * @param string $part
* *
@ -1240,7 +1259,7 @@ class QueryBuilder
} }
/** /**
* Deep clone of all expression objects in the DQL parts. * Deep clones all expression objects in the DQL parts.
* *
* @return void * @return void
*/ */

View File

@ -25,7 +25,6 @@ use Symfony\Component\Console\Input\InputArgument,
Doctrine\ORM\Tools\Export\ClassMetadataExporter, Doctrine\ORM\Tools\Export\ClassMetadataExporter,
Doctrine\ORM\Tools\ConvertDoctrine1Schema, Doctrine\ORM\Tools\ConvertDoctrine1Schema,
Doctrine\ORM\Tools\EntityGenerator; Doctrine\ORM\Tools\EntityGenerator;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;

View File

@ -23,7 +23,6 @@ use Doctrine\ORM\Query\TreeWalkerAdapter;
use Doctrine\ORM\Query\AST\SelectStatement; use Doctrine\ORM\Query\AST\SelectStatement;
use Doctrine\ORM\Query\AST\SelectExpression; use Doctrine\ORM\Query\AST\SelectExpression;
use Doctrine\ORM\Query\AST\PathExpression; use Doctrine\ORM\Query\AST\PathExpression;
use Doctrine\ORM\Query\AST\AggregateExpression;
/** /**
* Replaces the selectClause of the AST with a SELECT DISTINCT root.id equivalent * Replaces the selectClause of the AST with a SELECT DISTINCT root.id equivalent

View File

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

View File

@ -373,7 +373,7 @@ class UnitOfWork implements PropertyChangedListener
} }
/** /**
* Compute the changesets of all entities scheduled for insertion * Computes the changesets of all entities scheduled for insertion.
* *
* @return void * @return void
*/ */
@ -387,14 +387,14 @@ class UnitOfWork implements PropertyChangedListener
} }
/** /**
* Only flush the given entity according to a ruleset that keeps the UoW consistent. * Only flushes the given entity according to a ruleset that keeps the UoW consistent.
* *
* 1. All entities scheduled for insertion, (orphan) removals and changes in collections are processed as well! * 1. All entities scheduled for insertion, (orphan) removals and changes in collections are processed as well!
* 2. Read Only entities are skipped. * 2. Read Only entities are skipped.
* 3. Proxies are skipped. * 3. Proxies are skipped.
* 4. Only if entity is properly managed. * 4. Only if entity is properly managed.
* *
* @param object $entity * @param object $entity
* *
* @return void * @return void
* *
@ -851,6 +851,8 @@ class UnitOfWork implements PropertyChangedListener
* @param ClassMetadata $class The class descriptor of the entity. * @param ClassMetadata $class The class descriptor of the entity.
* @param object $entity The entity for which to (re)calculate the change set. * @param object $entity The entity for which to (re)calculate the change set.
* *
* @return void
*
* @throws ORMInvalidArgumentException If the passed entity is not MANAGED. * @throws ORMInvalidArgumentException If the passed entity is not MANAGED.
*/ */
public function recomputeSingleEntityChangeSet(ClassMetadata $class, $entity) public function recomputeSingleEntityChangeSet(ClassMetadata $class, $entity)
@ -2808,11 +2810,11 @@ class UnitOfWork implements PropertyChangedListener
} }
/** /**
* Process an entity instance to extract their identifier values. * Processes an entity instance to extract their identifier values.
* *
* @param object $entity The entity instance. * @param object $entity The entity instance.
* *
* @return scalar * @return mixed A scalar value.
* *
* @throws \Doctrine\ORM\ORMInvalidArgumentException * @throws \Doctrine\ORM\ORMInvalidArgumentException
*/ */
@ -2838,8 +2840,8 @@ class UnitOfWork implements PropertyChangedListener
* @param mixed $id The entity identifier to look for. * @param mixed $id The entity identifier to look for.
* @param string $rootClassName The name of the root class of the mapped entity hierarchy. * @param string $rootClassName The name of the root class of the mapped entity hierarchy.
* *
* @return mixed Returns the entity with the specified identifier if it exists in * @return object|bool Returns the entity with the specified identifier if it exists in
* this UnitOfWork, FALSE otherwise. * this UnitOfWork, FALSE otherwise.
*/ */
public function tryGetById($id, $rootClassName) public function tryGetById($id, $rootClassName)
{ {
@ -3058,7 +3060,7 @@ class UnitOfWork implements PropertyChangedListener
} }
/** /**
* Get the currently scheduled complete collection deletions * Gets the currently scheduled complete collection deletions
* *
* @return array * @return array
*/ */