1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Merge branch 'TrailingWhitespaces'

This commit is contained in:
Benjamin Eberlei 2011-12-19 22:56:52 +01:00
commit 6c4aaab2d6
268 changed files with 1724 additions and 1724 deletions

View File

@ -616,7 +616,7 @@ abstract class AbstractQuery
$this->_queryCacheProfile = $this->_queryCacheProfile $this->_queryCacheProfile = $this->_queryCacheProfile
? $this->_queryCacheProfile->setCacheKey($id) ? $this->_queryCacheProfile->setCacheKey($id)
: new QueryCacheProfile(0, $id); : new QueryCacheProfile(0, $id);
return $this; return $this;
} }

View File

@ -523,14 +523,14 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Set default repository class. * Set default repository class.
* *
* @since 2.2 * @since 2.2
* @param string $className * @param string $className
* @throws ORMException If not is a \Doctrine\ORM\EntityRepository * @throws ORMException If not is a \Doctrine\ORM\EntityRepository
*/ */
public function setDefaultRepositoryClassName($className) public function setDefaultRepositoryClassName($className)
{ {
if ($className != "Doctrine\ORM\EntityRepository" && if ($className != "Doctrine\ORM\EntityRepository" &&
!is_subclass_of($className, 'Doctrine\ORM\EntityRepository')){ !is_subclass_of($className, 'Doctrine\ORM\EntityRepository')){
throw ORMException::invalidEntityRepository($className); throw ORMException::invalidEntityRepository($className);
} }
@ -539,7 +539,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
/** /**
* Get default repository class. * Get default repository class.
* *
* @since 2.2 * @since 2.2
* @return string * @return string
*/ */

View File

@ -42,10 +42,10 @@ class LifecycleEventArgs extends EventArgs
* @var object * @var object
*/ */
private $entity; private $entity;
/** /**
* Constructor * Constructor
* *
* @param object $entity * @param object $entity
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
*/ */
@ -54,11 +54,11 @@ class LifecycleEventArgs extends EventArgs
$this->entity = $entity; $this->entity = $entity;
$this->em = $em; $this->em = $em;
} }
/** /**
* Retireve associated Entity. * Retireve associated Entity.
* *
* @return object * @return object
*/ */
public function getEntity() public function getEntity()
{ {
@ -67,7 +67,7 @@ class LifecycleEventArgs extends EventArgs
/** /**
* Retrieve associated EntityManager. * Retrieve associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */
public function getEntityManager() public function getEntityManager()

View File

@ -43,7 +43,7 @@ class LoadClassMetadataEventArgs extends EventArgs
/** /**
* Constructor. * Constructor.
* *
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata * @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
*/ */
@ -55,7 +55,7 @@ class LoadClassMetadataEventArgs extends EventArgs
/** /**
* Retrieve associated ClassMetadata. * Retrieve associated ClassMetadata.
* *
* @return \Doctrine\ORM\Mapping\ClassMetadataInfo * @return \Doctrine\ORM\Mapping\ClassMetadataInfo
*/ */
public function getClassMetadata() public function getClassMetadata()
@ -65,7 +65,7 @@ class LoadClassMetadataEventArgs extends EventArgs
/** /**
* Retrieve associated EntityManager. * Retrieve associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */
public function getEntityManager() public function getEntityManager()

View File

@ -42,7 +42,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
/** /**
* Constructor. * Constructor.
* *
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
* @param string $entityClass Optional entity class * @param string $entityClass Optional entity class
*/ */
@ -54,7 +54,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs
/** /**
* Retrieve associated EntityManager. * Retrieve associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */
public function getEntityManager() public function getEntityManager()

View File

@ -38,13 +38,13 @@ class OnFlushEventArgs extends \Doctrine\Common\EventArgs
* @var Doctirne\ORM\EntityManager * @var Doctirne\ORM\EntityManager
*/ */
private $em; private $em;
//private $entitiesToPersist = array(); //private $entitiesToPersist = array();
//private $entitiesToRemove = array(); //private $entitiesToRemove = array();
/** /**
* Constructor. * Constructor.
* *
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
*/ */
public function __construct(EntityManager $em) public function __construct(EntityManager $em)
@ -54,30 +54,30 @@ class OnFlushEventArgs extends \Doctrine\Common\EventArgs
/** /**
* Retrieve associated EntityManager. * Retrieve associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */
public function getEntityManager() public function getEntityManager()
{ {
return $this->em; return $this->em;
} }
/* /*
public function addEntityToPersist($entity) public function addEntityToPersist($entity)
{ {
} }
public function addEntityToRemove($entity) public function addEntityToRemove($entity)
{ {
} }
public function addEntityToUpdate($entity) public function addEntityToUpdate($entity)
{ {
} }
public function getEntitiesToPersist() public function getEntitiesToPersist()
{ {
return $this->_entitiesToPersist; return $this->_entitiesToPersist;

View File

@ -41,7 +41,7 @@ class PostFlushEventArgs extends EventArgs
/** /**
* Constructor. * Constructor.
* *
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
*/ */
public function __construct(EntityManager $em) public function __construct(EntityManager $em)
@ -51,7 +51,7 @@ class PostFlushEventArgs extends EventArgs
/** /**
* Retrieve associated EntityManager. * Retrieve associated EntityManager.
* *
* @return \Doctrine\ORM\EntityManager * @return \Doctrine\ORM\EntityManager
*/ */
public function getEntityManager() public function getEntityManager()

View File

@ -41,7 +41,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs
/** /**
* Constructor. * Constructor.
* *
* @param object $entity * @param object $entity
* @param \Doctrine\ORM\EntityManager $em * @param \Doctrine\ORM\EntityManager $em
* @param array $changeSet * @param array $changeSet
@ -49,13 +49,13 @@ class PreUpdateEventArgs extends LifecycleEventArgs
public function __construct($entity, EntityManager $em, array &$changeSet) public function __construct($entity, EntityManager $em, array &$changeSet)
{ {
parent::__construct($entity, $em); parent::__construct($entity, $em);
$this->entityChangeSet = &$changeSet; $this->entityChangeSet = &$changeSet;
} }
/** /**
* Retrieve entity changeset. * Retrieve entity changeset.
* *
* @return array * @return array
*/ */
public function getEntityChangeSet() public function getEntityChangeSet()
@ -75,7 +75,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs
/** /**
* Get the old value of the changeset of the changed field. * Get the old value of the changeset of the changed field.
* *
* @param string $field * @param string $field
* @return mixed * @return mixed
*/ */
@ -101,7 +101,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs
/** /**
* Set the new value of this field. * Set the new value of this field.
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
*/ */
@ -114,8 +114,8 @@ class PreUpdateEventArgs extends LifecycleEventArgs
/** /**
* Assert the field exists in changeset. * Assert the field exists in changeset.
* *
* @param string $field * @param string $field
*/ */
private function assertValidField($field) private function assertValidField($field)
{ {

View File

@ -35,55 +35,55 @@ final class Events
/** /**
* 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.
* *
* This is an entity lifecycle event. * This is an entity lifecycle event.
* *
* @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.
* *
* This is an entity lifecycle event. * This is an entity lifecycle event.
* *
* @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.
* *
* This is an entity lifecycle event. * This is an entity lifecycle event.
* *
* @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.
* Generated primary key values are available in the postPersist event. * Generated primary key values are available in the postPersist event.
* *
* This is an entity lifecycle event. * This is an entity lifecycle event.
* *
* @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.
* *
* This is an entity lifecycle event. * This is an entity lifecycle event.
* *
* @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.
* *
* This is an entity lifecycle event. * This is an entity lifecycle event.
* *
* @var string * @var string
*/ */
const postUpdate = 'postUpdate'; const postUpdate = 'postUpdate';
@ -91,24 +91,24 @@ final class Events
* 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
* has been applied to it. * has been applied to it.
* *
* Note that the postLoad event occurs for an entity before any associations have been * Note that the postLoad event occurs for an entity before any associations have been
* initialized. Therefore it is not safe to access associations in a postLoad callback * initialized. Therefore it is not safe to access associations in a postLoad callback
* or event handler. * or event handler.
* *
* This is an entity lifecycle event. * This is an entity lifecycle event.
* *
* @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).
* *
* @var string * @var string
*/ */
const loadClassMetadata = 'loadClassMetadata'; const loadClassMetadata = 'loadClassMetadata';
/** /**
* The preFlush event occurs when the EntityManager#flush() operation is invoked, * The preFlush event occurs when the EntityManager#flush() operation is invoked,
* but before any changes to managed entites have been calculated. This event is * but before any changes to managed entites have been calculated. This event is
@ -122,7 +122,7 @@ final class Events
* actual database operations are executed. The event is only raised if there is * actual database operations are executed. The event is only raised if there is
* actually something to do for the underlying UnitOfWork. If nothing needs to be done, * actually something to do for the underlying UnitOfWork. If nothing needs to be done,
* the onFlush event is not raised. * the onFlush event is not raised.
* *
* @var string * @var string
*/ */
const onFlush = 'onFlush'; const onFlush = 'onFlush';
@ -133,11 +133,11 @@ final class Events
* actually something to do for the underlying UnitOfWork. If nothing needs to be done, * actually something to do for the underlying UnitOfWork. If nothing needs to be done,
* the postFlush event is not raised. The event won't be raised if an error occurs during the * the postFlush event is not raised. The event won't be raised if an error occurs during the
* flush operation. * flush operation.
* *
* @var string * @var string
*/ */
const postFlush = 'postFlush'; const postFlush = 'postFlush';
/** /**
* The onClear event occurs when the EntityManager#clear() operation is invoked, * The onClear event occurs when the EntityManager#clear() operation is invoked,
* after all references to entities have been removed from the unit of work. * after all references to entities have been removed from the unit of work.

View File

@ -35,7 +35,7 @@ abstract class AbstractIdGenerator
* Gets whether this generator is a post-insert generator which means that * Gets whether this generator is a post-insert generator which means that
* {@link generate()} must be called after the entity has been inserted * {@link generate()} must be called after the entity has been inserted
* into the database. * into the database.
* *
* By default, this method returns FALSE. Generators that have this requirement * By default, this method returns FALSE. Generators that have this requirement
* must override this method and return TRUE. * must override this method and return TRUE.
* *

View File

@ -46,14 +46,14 @@ class AssignedGenerator extends AbstractIdGenerator
$class = $em->getClassMetadata(get_class($entity)); $class = $em->getClassMetadata(get_class($entity));
$idFields = $class->getIdentifierFieldNames(); $idFields = $class->getIdentifierFieldNames();
$identifier = array(); $identifier = array();
foreach ($idFields as $idField) { foreach ($idFields as $idField) {
$value = $class->reflFields[$idField]->getValue($entity); $value = $class->reflFields[$idField]->getValue($entity);
if ( ! isset($value)) { if ( ! isset($value)) {
throw ORMException::entityMissingAssignedIdForField($entity, $idField); throw ORMException::entityMissingAssignedIdForField($entity, $idField);
} }
if (isset($class->associationMappings[$idField])) { if (isset($class->associationMappings[$idField])) {
if ( ! $em->getUnitOfWork()->isInIdentityMap($value)) { if ( ! $em->getUnitOfWork()->isInIdentityMap($value)) {
throw ORMException::entityMissingForeignAssignedId($entity, $value); throw ORMException::entityMissingForeignAssignedId($entity, $value);
@ -62,10 +62,10 @@ class AssignedGenerator extends AbstractIdGenerator
// NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced. // NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced.
$value = current($em->getUnitOfWork()->getEntityIdentifier($value)); $value = current($em->getUnitOfWork()->getEntityIdentifier($value));
} }
$identifier[$idField] = $value; $identifier[$idField] = $value;
} }
return $identifier; return $identifier;
} }
} }

View File

@ -50,12 +50,12 @@ class TableGenerator extends AbstractIdGenerator
if ($this->_maxValue === null || $this->_nextValue == $this->_maxValue) { if ($this->_maxValue === null || $this->_nextValue == $this->_maxValue) {
// Allocate new values // Allocate new values
$conn = $em->getConnection(); $conn = $em->getConnection();
if ($conn->getTransactionNestingLevel() === 0) { if ($conn->getTransactionNestingLevel() === 0) {
// use select for update // use select for update
$sql = $conn->getDatabasePlatform()->getTableHiLoCurrentValSql($this->_tableName, $this->_sequenceName); $sql = $conn->getDatabasePlatform()->getTableHiLoCurrentValSql($this->_tableName, $this->_sequenceName);
$currentLevel = $conn->fetchColumn($sql); $currentLevel = $conn->fetchColumn($sql);
if ($currentLevel != null) { if ($currentLevel != null) {
$this->_nextValue = $currentLevel; $this->_nextValue = $currentLevel;
$this->_maxValue = $this->_nextValue + $this->_allocationSize; $this->_maxValue = $this->_nextValue + $this->_allocationSize;
@ -63,7 +63,7 @@ class TableGenerator extends AbstractIdGenerator
$updateSql = $conn->getDatabasePlatform()->getTableHiLoUpdateNextValSql( $updateSql = $conn->getDatabasePlatform()->getTableHiLoUpdateNextValSql(
$this->_tableName, $this->_sequenceName, $this->_allocationSize $this->_tableName, $this->_sequenceName, $this->_allocationSize
); );
if ($conn->executeUpdate($updateSql, array(1 => $currentLevel, 2 => $currentLevel+1)) !== 1) { if ($conn->executeUpdate($updateSql, array(1 => $currentLevel, 2 => $currentLevel+1)) !== 1) {
// no affected rows, concurrency issue, throw exception // no affected rows, concurrency issue, throw exception
} }
@ -75,7 +75,7 @@ class TableGenerator extends AbstractIdGenerator
// or do we want to work with table locks exclusively? // or do we want to work with table locks exclusively?
} }
} }
return $this->_nextValue++; return $this->_nextValue++;
} }
} }

View File

@ -24,7 +24,7 @@ namespace Doctrine\ORM\Internal;
* correct order in which changes to entities need to be persisted. * correct order in which changes to entities need to be persisted.
* *
* @since 2.0 * @since 2.0
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
*/ */
class CommitOrderCalculator class CommitOrderCalculator
@ -32,12 +32,12 @@ class CommitOrderCalculator
const NOT_VISITED = 1; const NOT_VISITED = 1;
const IN_PROGRESS = 2; const IN_PROGRESS = 2;
const VISITED = 3; const VISITED = 3;
private $_nodeStates = array(); private $_nodeStates = array();
private $_classes = array(); // The nodes to sort private $_classes = array(); // The nodes to sort
private $_relatedClasses = array(); private $_relatedClasses = array();
private $_sorted = array(); private $_sorted = array();
/** /**
* Clears the current graph. * Clears the current graph.
* *
@ -48,10 +48,10 @@ class CommitOrderCalculator
$this->_classes = $this->_classes =
$this->_relatedClasses = array(); $this->_relatedClasses = array();
} }
/** /**
* Gets a valid commit order for all current nodes. * Gets a valid commit order for all current nodes.
* *
* Uses a depth-first search (DFS) to traverse the graph. * Uses a depth-first search (DFS) to traverse the graph.
* The desired topological sorting is the reverse postorder of these searches. * The desired topological sorting is the reverse postorder of these searches.
* *
@ -65,12 +65,12 @@ class CommitOrderCalculator
if ($nodeCount <= 1) { if ($nodeCount <= 1) {
return ($nodeCount == 1) ? array_values($this->_classes) : array(); return ($nodeCount == 1) ? array_values($this->_classes) : array();
} }
// Init // Init
foreach ($this->_classes as $node) { foreach ($this->_classes as $node) {
$this->_nodeStates[$node->name] = self::NOT_VISITED; $this->_nodeStates[$node->name] = self::NOT_VISITED;
} }
// Go // Go
foreach ($this->_classes as $node) { foreach ($this->_classes as $node) {
if ($this->_nodeStates[$node->name] == self::NOT_VISITED) { if ($this->_nodeStates[$node->name] == self::NOT_VISITED) {
@ -100,17 +100,17 @@ class CommitOrderCalculator
$this->_nodeStates[$node->name] = self::VISITED; $this->_nodeStates[$node->name] = self::VISITED;
$this->_sorted[] = $node; $this->_sorted[] = $node;
} }
public function addDependency($fromClass, $toClass) public function addDependency($fromClass, $toClass)
{ {
$this->_relatedClasses[$fromClass->name][] = $toClass; $this->_relatedClasses[$fromClass->name][] = $toClass;
} }
public function hasClass($className) public function hasClass($className)
{ {
return isset($this->_classes[$className]); return isset($this->_classes[$className]);
} }
public function addClass($class) public function addClass($class)
{ {
$this->_classes[$class->name] = $class; $this->_classes[$class->name] = $class;

View File

@ -233,20 +233,20 @@ class ObjectHydrator extends AbstractHydrator
} }
$this->_hints['fetchAlias'] = $dqlAlias; $this->_hints['fetchAlias'] = $dqlAlias;
$entity = $this->_uow->createEntity($className, $data, $this->_hints); $entity = $this->_uow->createEntity($className, $data, $this->_hints);
//TODO: These should be invoked later, after hydration, because associations may not yet be loaded here. //TODO: These should be invoked later, after hydration, because associations may not yet be loaded here.
if (isset($this->_ce[$className]->lifecycleCallbacks[Events::postLoad])) { if (isset($this->_ce[$className]->lifecycleCallbacks[Events::postLoad])) {
$this->_ce[$className]->invokeLifecycleCallbacks(Events::postLoad, $entity); $this->_ce[$className]->invokeLifecycleCallbacks(Events::postLoad, $entity);
} }
$evm = $this->_em->getEventManager(); $evm = $this->_em->getEventManager();
if ($evm->hasListeners(Events::postLoad)) { if ($evm->hasListeners(Events::postLoad)) {
$evm->dispatchEvent(Events::postLoad, new LifecycleEventArgs($entity, $this->_em)); $evm->dispatchEvent(Events::postLoad, new LifecycleEventArgs($entity, $this->_em));
} }
return $entity; return $entity;
} }

View File

@ -32,22 +32,22 @@ use Doctrine\DBAL\Connection;
*/ */
class ScalarHydrator extends AbstractHydrator class ScalarHydrator extends AbstractHydrator
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function hydrateAllData() protected function hydrateAllData()
{ {
$result = array(); $result = array();
$cache = array(); $cache = array();
while ($data = $this->_stmt->fetch(\PDO::FETCH_ASSOC)) { while ($data = $this->_stmt->fetch(\PDO::FETCH_ASSOC)) {
$this->hydrateRowData($data, $cache, $result); $this->hydrateRowData($data, $cache, $result);
} }
return $result; return $result;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function hydrateRowData(array $data, array &$cache, array &$result) protected function hydrateRowData(array $data, array &$cache, array &$result)

View File

@ -63,18 +63,18 @@ class SimpleObjectHydrator extends AbstractHydrator
if (count($this->_rsm->aliasMap) !== 1) { if (count($this->_rsm->aliasMap) !== 1) {
throw new \RuntimeException("Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result."); throw new \RuntimeException("Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result.");
} }
if ($this->_rsm->scalarMappings) { if ($this->_rsm->scalarMappings) {
throw new \RuntimeException("Cannot use SimpleObjectHydrator with a ResultSetMapping that contains scalar mappings."); throw new \RuntimeException("Cannot use SimpleObjectHydrator with a ResultSetMapping that contains scalar mappings.");
} }
$this->class = $this->_em->getClassMetadata(reset($this->_rsm->aliasMap)); $this->class = $this->_em->getClassMetadata(reset($this->_rsm->aliasMap));
// We only need to add declaring classes if we have inheritance. // We only need to add declaring classes if we have inheritance.
if ($this->class->inheritanceType === ClassMetadata::INHERITANCE_TYPE_NONE) { if ($this->class->inheritanceType === ClassMetadata::INHERITANCE_TYPE_NONE) {
return; return;
} }
foreach ($this->_rsm->declaringClasses AS $column => $class) { foreach ($this->_rsm->declaringClasses AS $column => $class) {
$this->declaringClasses[$column] = $this->_em->getClassMetadata($class); $this->declaringClasses[$column] = $this->_em->getClassMetadata($class);
} }
@ -87,27 +87,27 @@ class SimpleObjectHydrator extends AbstractHydrator
{ {
$entityName = $this->class->name; $entityName = $this->class->name;
$data = array(); $data = array();
// We need to find the correct entity class name if we have inheritance in resultset // We need to find the correct entity class name if we have inheritance in resultset
if ($this->class->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) { if ($this->class->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
$discrColumnName = $this->_platform->getSQLResultCasing($this->class->discriminatorColumn['name']); $discrColumnName = $this->_platform->getSQLResultCasing($this->class->discriminatorColumn['name']);
if ($sqlResult[$discrColumnName] === '') { if ($sqlResult[$discrColumnName] === '') {
throw HydrationException::emptyDiscriminatorValue(key($this->_rsm->aliasMap)); throw HydrationException::emptyDiscriminatorValue(key($this->_rsm->aliasMap));
} }
$entityName = $this->class->discriminatorMap[$sqlResult[$discrColumnName]]; $entityName = $this->class->discriminatorMap[$sqlResult[$discrColumnName]];
unset($sqlResult[$discrColumnName]); unset($sqlResult[$discrColumnName]);
} }
foreach ($sqlResult as $column => $value) { foreach ($sqlResult as $column => $value) {
// Hydrate column information if not yet present // Hydrate column information if not yet present
if ( ! isset($cache[$column])) { if ( ! isset($cache[$column])) {
if (($info = $this->hydrateColumnInfo($entityName, $column)) === null) { if (($info = $this->hydrateColumnInfo($entityName, $column)) === null) {
continue; continue;
} }
$cache[$column] = $info; $cache[$column] = $info;
} }
@ -116,7 +116,7 @@ class SimpleObjectHydrator extends AbstractHydrator
$type = Type::getType($cache[$column]['class']->fieldMappings[$cache[$column]['name']]['type']); $type = Type::getType($cache[$column]['class']->fieldMappings[$cache[$column]['name']]['type']);
$value = $type->convertToPHPValue($value, $this->_platform); $value = $type->convertToPHPValue($value, $this->_platform);
} }
// Prevent overwrite in case of inherit classes using same property name (See AbstractHydrator) // Prevent overwrite in case of inherit classes using same property name (See AbstractHydrator)
if (isset($cache[$column]) && ( ! isset($data[$cache[$column]['name']]) || $value !== null)) { if (isset($cache[$column]) && ( ! isset($data[$cache[$column]['name']]) || $value !== null)) {
$data[$cache[$column]['name']] = $value; $data[$cache[$column]['name']] = $value;
@ -129,7 +129,7 @@ class SimpleObjectHydrator extends AbstractHydrator
$uow = $this->_em->getUnitOfWork(); $uow = $this->_em->getUnitOfWork();
$entity = $uow->createEntity($entityName, $data, $this->_hints); $entity = $uow->createEntity($entityName, $data, $this->_hints);
//TODO: These should be invoked later, after hydration, because associations may not yet be loaded here. //TODO: These should be invoked later, after hydration, because associations may not yet be loaded here.
if (isset($this->class->lifecycleCallbacks[Events::postLoad])) { if (isset($this->class->lifecycleCallbacks[Events::postLoad])) {
$this->class->invokeLifecycleCallbacks(Events::postLoad, $entity); $this->class->invokeLifecycleCallbacks(Events::postLoad, $entity);
@ -140,24 +140,24 @@ class SimpleObjectHydrator extends AbstractHydrator
if ($evm->hasListeners(Events::postLoad)) { if ($evm->hasListeners(Events::postLoad)) {
$evm->dispatchEvent(Events::postLoad, new LifecycleEventArgs($entity, $this->_em)); $evm->dispatchEvent(Events::postLoad, new LifecycleEventArgs($entity, $this->_em));
} }
$result[] = $entity; $result[] = $entity;
} }
/** /**
* Retrieve column information form ResultSetMapping. * Retrieve column information form ResultSetMapping.
* *
* @param string $entityName * @param string $entityName
* @param string $column * @param string $column
* *
* @return array * @return array
*/ */
protected function hydrateColumnInfo($entityName, $column) protected function hydrateColumnInfo($entityName, $column)
{ {
switch (true) { switch (true) {
case (isset($this->_rsm->fieldMappings[$column])): case (isset($this->_rsm->fieldMappings[$column])):
$class = isset($this->declaringClasses[$column]) $class = isset($this->declaringClasses[$column])
? $this->declaringClasses[$column] ? $this->declaringClasses[$column]
: $this->class; : $this->class;
// If class is not part of the inheritance, ignore // If class is not part of the inheritance, ignore
@ -172,8 +172,8 @@ class SimpleObjectHydrator extends AbstractHydrator
); );
case (isset($this->_rsm->relationMap[$column])): case (isset($this->_rsm->relationMap[$column])):
$class = isset($this->_rsm->relationMap[$column]) $class = isset($this->_rsm->relationMap[$column])
? $this->_rsm->relationMap[$column] ? $this->_rsm->relationMap[$column]
: $this->class; : $this->class;
// If class is not self referencing, ignore // If class is not self referencing, ignore
@ -181,7 +181,7 @@ class SimpleObjectHydrator extends AbstractHydrator
return null; return null;
} }
// TODO: Decide what to do with associations. It seems original code is incomplete. // TODO: Decide what to do with associations. It seems original code is incomplete.
// One solution is to load the association, but it might require extra efforts. // One solution is to load the association, but it might require extra efforts.
return array('name' => $column); return array('name' => $column);

View File

@ -33,24 +33,24 @@ use Doctrine\DBAL\Connection,
class SingleScalarHydrator extends AbstractHydrator class SingleScalarHydrator extends AbstractHydrator
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function hydrateAllData() protected function hydrateAllData()
{ {
$data = $this->_stmt->fetchAll(\PDO::FETCH_ASSOC); $data = $this->_stmt->fetchAll(\PDO::FETCH_ASSOC);
$numRows = count($data); $numRows = count($data);
if ($numRows === 0) { if ($numRows === 0) {
throw new NoResultException(); throw new NoResultException();
} }
if ($numRows > 1 || count($data[key($data)]) > 1) { if ($numRows > 1 || count($data[key($data)]) > 1) {
throw new NonUniqueResultException(); throw new NonUniqueResultException();
} }
$cache = array(); $cache = array();
$result = $this->gatherScalarRowData($data[key($data)], $cache); $result = $this->gatherScalarRowData($data[key($data)], $cache);
return array_shift($result); return array_shift($result);
} }
} }

View File

@ -124,7 +124,7 @@ class AssociationBuilder
/** /**
* Add Join Columns * Add Join Columns
* *
* @param string $columnName * @param string $columnName
* @param string $referencedColumnName * @param string $referencedColumnName
* @param bool $nullable * @param bool $nullable

View File

@ -62,7 +62,7 @@ class ClassMetadataBuilder
public function setMappedSuperClass() public function setMappedSuperClass()
{ {
$this->cm->isMappedSuperclass = true; $this->cm->isMappedSuperclass = true;
return $this; return $this;
} }

View File

@ -170,7 +170,7 @@ class FieldBuilder
/** /**
* Set Sequence Generator * Set Sequence Generator
* *
* @param string $sequenceName * @param string $sequenceName
* @param int $allocationSize * @param int $allocationSize
* @param int $initialValue * @param int $initialValue
@ -188,7 +188,7 @@ class FieldBuilder
/** /**
* Set column definition. * Set column definition.
* *
* @param string $def * @param string $def
* @return FieldBuilder * @return FieldBuilder
*/ */

View File

@ -358,7 +358,7 @@ class ClassMetadata extends ClassMetadataInfo implements IClassMetadata
($this->reflClass->getMethod($callback)->getModifiers() & \ReflectionMethod::IS_PUBLIC) == 0) { ($this->reflClass->getMethod($callback)->getModifiers() & \ReflectionMethod::IS_PUBLIC) == 0) {
throw MappingException::lifecycleCallbackMethodNotFound($this->name, $callback); throw MappingException::lifecycleCallbackMethodNotFound($this->name, $callback);
} }
return parent::addLifecycleCallback($callback, $event); return parent::addLifecycleCallback($callback, $event);
} }
} }

View File

@ -43,7 +43,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
* @var EntityManager * @var EntityManager
*/ */
private $em; private $em;
/** /**
* @var AbstractPlatform * @var AbstractPlatform
*/ */
@ -73,7 +73,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
* @var bool * @var bool
*/ */
private $initialized = false; private $initialized = false;
/** /**
* @param EntityManager $$em * @param EntityManager $$em
*/ */
@ -101,16 +101,16 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
{ {
return $this->cacheDriver; return $this->cacheDriver;
} }
public function getLoadedMetadata() public function getLoadedMetadata()
{ {
return $this->loadedMetadata; return $this->loadedMetadata;
} }
/** /**
* Forces the factory to load the metadata of all classes known to the underlying * Forces the factory to load the metadata of all classes known to the underlying
* mapping driver. * mapping driver.
* *
* @return array The ClassMetadata instances of all mapped classes. * @return array The ClassMetadata instances of all mapped classes.
*/ */
public function getAllMetadata() public function getAllMetadata()
@ -188,7 +188,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
/** /**
* Checks whether the factory has the metadata for a class loaded already. * Checks whether the factory has the metadata for a class loaded already.
* *
* @param string $className * @param string $className
* @return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise. * @return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise.
*/ */
@ -199,7 +199,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
/** /**
* Sets the metadata descriptor for a specific class. * Sets the metadata descriptor for a specific class.
* *
* NOTE: This is only useful in very special cases, like when generating proxy classes. * NOTE: This is only useful in very special cases, like when generating proxy classes.
* *
* @param string $className * @param string $className
@ -308,11 +308,11 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
if ($parent && $parent->isInheritanceTypeSingleTable()) { if ($parent && $parent->isInheritanceTypeSingleTable()) {
$class->setPrimaryTable($parent->table); $class->setPrimaryTable($parent->table);
} }
if ($parent && $parent->containsForeignIdentifier) { if ($parent && $parent->containsForeignIdentifier) {
$class->containsForeignIdentifier = true; $class->containsForeignIdentifier = true;
} }
if ($parent && !empty ($parent->namedQueries)) { if ($parent && !empty ($parent->namedQueries)) {
$this->addInheritedNamedQueries($class, $parent); $this->addInheritedNamedQueries($class, $parent);
} }
@ -325,7 +325,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
} }
$this->validateRuntimeMetadata($class, $parent); $this->validateRuntimeMetadata($class, $parent);
$this->loadedMetadata[$className] = $class; $this->loadedMetadata[$className] = $class;
$parent = $class; $parent = $class;
@ -436,10 +436,10 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
$subClass->addInheritedAssociationMapping($mapping); $subClass->addInheritedAssociationMapping($mapping);
} }
} }
/** /**
* Adds inherited named queries to the subclass mapping. * Adds inherited named queries to the subclass mapping.
* *
* @since 2.2 * @since 2.2
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
@ -524,13 +524,13 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
if ( ! $this->initialized) { if ( ! $this->initialized) {
$this->initialize(); $this->initialize();
} }
// Check for namespace alias // Check for namespace alias
if (strpos($class, ':') !== false) { if (strpos($class, ':') !== false) {
list($namespaceAlias, $simpleClassName) = explode(':', $class); list($namespaceAlias, $simpleClassName) = explode(':', $class);
$class = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName; $class = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
} }
return $this->driver->isTransient($class); return $this->driver->isTransient($class);
} }
} }

View File

@ -25,7 +25,7 @@ use Doctrine\ORM\Mapping\MappingException;
/** /**
* Base driver for file-based metadata drivers. * Base driver for file-based metadata drivers.
* *
* A file driver operates in a mode where it loads the mapping files of individual * A file driver operates in a mode where it loads the mapping files of individual
* classes on demand. This requires the user to adhere to the convention of 1 mapping * classes on demand. This requires the user to adhere to the convention of 1 mapping
* file per class and the file names of the mapping files must correspond to the full * file per class and the file names of the mapping files must correspond to the full
@ -56,16 +56,16 @@ abstract class AbstractFileDriver implements Driver
*/ */
protected $_fileExtension; protected $_fileExtension;
/** /**
* Initializes a new FileDriver that looks in the given path(s) for mapping * Initializes a new FileDriver that looks in the given path(s) for mapping
* documents and operates in the specified operating mode. * documents and operates in the specified operating mode.
* *
* @param string|array $paths One or multiple paths where mapping documents can be found. * @param string|array $paths One or multiple paths where mapping documents can be found.
*/ */
public function __construct($paths) public function __construct($paths)
{ {
$this->addPaths((array) $paths); $this->addPaths((array) $paths);
} }
/** /**
* Append lookup paths to metadata driver. * Append lookup paths to metadata driver.
@ -117,7 +117,7 @@ abstract class AbstractFileDriver implements Driver
public function getElement($className) public function getElement($className)
{ {
$result = $this->_loadMappingFile($this->_findMappingFile($className)); $result = $this->_loadMappingFile($this->_findMappingFile($className));
if(!isset($result[$className])){ if(!isset($result[$className])){
throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->_fileExtension); throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->_fileExtension);
} }
@ -148,7 +148,7 @@ abstract class AbstractFileDriver implements Driver
/** /**
* Gets the names of all mapped classes known to this driver. * Gets the names of all mapped classes known to this driver.
* *
* @return array The names of all mapped classes known to this driver. * @return array The names of all mapped classes known to this driver.
*/ */
public function getAllClassNames() public function getAllClassNames()
@ -160,23 +160,23 @@ abstract class AbstractFileDriver implements Driver
if ( ! is_dir($path)) { if ( ! is_dir($path)) {
throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
} }
$iterator = new \RecursiveIteratorIterator( $iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($path), new \RecursiveDirectoryIterator($path),
\RecursiveIteratorIterator::LEAVES_ONLY \RecursiveIteratorIterator::LEAVES_ONLY
); );
foreach ($iterator as $file) { foreach ($iterator as $file) {
if (($fileName = $file->getBasename($this->_fileExtension)) == $file->getBasename()) { if (($fileName = $file->getBasename($this->_fileExtension)) == $file->getBasename()) {
continue; continue;
} }
// NOTE: All files found here means classes are not transient! // NOTE: All files found here means classes are not transient!
$classes[] = str_replace('.', '\\', $fileName); $classes[] = str_replace('.', '\\', $fileName);
} }
} }
} }
return $classes; return $classes;
} }
@ -191,7 +191,7 @@ abstract class AbstractFileDriver implements Driver
protected function _findMappingFile($className) protected function _findMappingFile($className)
{ {
$fileName = str_replace('\\', '.', $className) . $this->_fileExtension; $fileName = str_replace('\\', '.', $className) . $this->_fileExtension;
// Check whether file exists // Check whether file exists
foreach ((array) $this->_paths as $path) { foreach ((array) $this->_paths as $path) {
if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) { if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) {
@ -205,7 +205,7 @@ abstract class AbstractFileDriver implements Driver
/** /**
* Loads a mapping file with the given name and returns a map * Loads a mapping file with the given name and returns a map
* from class/entity names to their corresponding elements. * from class/entity names to their corresponding elements.
* *
* @param string $file The mapping file to load. * @param string $file The mapping file to load.
* @return array * @return array
*/ */

View File

@ -99,7 +99,7 @@ class AnnotationDriver implements Driver
/** /**
* Retrieve the current annotation reader * Retrieve the current annotation reader
* *
* @return AnnotationReader * @return AnnotationReader
*/ */
public function getReader() public function getReader()
@ -519,15 +519,15 @@ class AnnotationDriver implements Driver
new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS),
\RecursiveIteratorIterator::LEAVES_ONLY \RecursiveIteratorIterator::LEAVES_ONLY
), ),
'/^.+' . str_replace('.', '\.', $this->_fileExtension) . '$/i', '/^.+' . str_replace('.', '\.', $this->_fileExtension) . '$/i',
\RecursiveRegexIterator::GET_MATCH \RecursiveRegexIterator::GET_MATCH
); );
foreach ($iterator as $file) { foreach ($iterator as $file) {
$sourceFile = realpath($file[0]); $sourceFile = realpath($file[0]);
require_once $sourceFile; require_once $sourceFile;
$includedFiles[] = $sourceFile; $includedFiles[] = $sourceFile;
} }
} }

View File

@ -76,7 +76,7 @@ class DatabaseDriver implements Driver
/** /**
* Initializes a new AnnotationDriver that uses the given AnnotationReader for reading * Initializes a new AnnotationDriver that uses the given AnnotationReader for reading
* docblock annotations. * docblock annotations.
* *
* @param AnnotationReader $reader The AnnotationReader to use. * @param AnnotationReader $reader The AnnotationReader to use.
*/ */
public function __construct(AbstractSchemaManager $schemaManager) public function __construct(AbstractSchemaManager $schemaManager)
@ -111,7 +111,7 @@ class DatabaseDriver implements Driver
} }
$tables = array(); $tables = array();
foreach ($this->_sm->listTableNames() as $tableName) { foreach ($this->_sm->listTableNames() as $tableName) {
$tables[$tableName] = $this->_sm->listTableDetails($tableName); $tables[$tableName] = $this->_sm->listTableDetails($tableName);
} }
@ -129,7 +129,7 @@ class DatabaseDriver implements Driver
foreach ($foreignKeys AS $foreignKey) { foreach ($foreignKeys AS $foreignKey) {
$allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns()); $allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
} }
$pkColumns = $table->getPrimaryKey()->getColumns(); $pkColumns = $table->getPrimaryKey()->getColumns();
sort($pkColumns); sort($pkColumns);
sort($allForeignKeyColumns); sort($allForeignKeyColumns);
@ -145,7 +145,7 @@ class DatabaseDriver implements Driver
} }
} }
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -169,7 +169,7 @@ class DatabaseDriver implements Driver
} catch(SchemaException $e) { } catch(SchemaException $e) {
$primaryKeyColumns = array(); $primaryKeyColumns = array();
} }
if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$foreignKeys = $this->tables[$tableName]->getForeignKeys(); $foreignKeys = $this->tables[$tableName]->getForeignKeys();
} else { } else {

View File

@ -34,18 +34,18 @@ interface Driver
{ {
/** /**
* Loads the metadata for the specified class into the provided container. * Loads the metadata for the specified class into the provided container.
* *
* @param string $className * @param string $className
* @param ClassMetadataInfo $metadata * @param ClassMetadataInfo $metadata
*/ */
function loadMetadataForClass($className, ClassMetadataInfo $metadata); function loadMetadataForClass($className, ClassMetadataInfo $metadata);
/** /**
* Gets the names of all mapped classes known to this driver. * Gets the names of all mapped classes known to this driver.
* *
* @return array The names of all mapped classes known to this driver. * @return array The names of all mapped classes known to this driver.
*/ */
function getAllClassNames(); function getAllClassNames();
/** /**
* Whether the class with the specified name should have its metadata loaded. * Whether the class with the specified name should have its metadata loaded.

View File

@ -94,7 +94,7 @@ class DriverChain implements Driver
if (!isset($driverClasses[$oid])) { if (!isset($driverClasses[$oid])) {
$driverClasses[$oid] = $driver->getAllClassNames(); $driverClasses[$oid] = $driver->getAllClassNames();
} }
foreach ($driverClasses[$oid] AS $className) { foreach ($driverClasses[$oid] AS $className) {
if (strpos($className, $namespace) === 0) { if (strpos($className, $namespace) === 0) {
$classNames[$className] = true; $classNames[$className] = true;

View File

@ -38,21 +38,21 @@ class StaticPHPDriver implements Driver
{ {
/** /**
* Paths of entity directories. * Paths of entity directories.
* *
* @var array * @var array
*/ */
private $_paths = array(); private $_paths = array();
/** /**
* Map of all class names. * Map of all class names.
* *
* @var array * @var array
*/ */
private $_classNames; private $_classNames;
/** /**
* The file extension of mapping documents. * The file extension of mapping documents.
* *
* @var string * @var string
*/ */
private $_fileExtension = '.php'; private $_fileExtension = '.php';

View File

@ -232,7 +232,7 @@ class XmlDriver extends AbstractFileDriver
if (isset($idElement['column'])) { if (isset($idElement['column'])) {
$mapping['columnName'] = (string)$idElement['column']; $mapping['columnName'] = (string)$idElement['column'];
} }
if (isset($idElement['column-definition'])) { if (isset($idElement['column-definition'])) {
$mapping['columnDefinition'] = (string)$idElement['column-definition']; $mapping['columnDefinition'] = (string)$idElement['column-definition'];
} }

View File

@ -181,7 +181,7 @@ class YamlDriver extends AbstractFileDriver
if (isset($idElement['length'])) { if (isset($idElement['length'])) {
$mapping['length'] = $idElement['length']; $mapping['length'] = $idElement['length'];
} }
if (isset($idElement['columnDefinition'])) { if (isset($idElement['columnDefinition'])) {
$mapping['columnDefinition'] = $idElement['columnDefinition']; $mapping['columnDefinition'] = $idElement['columnDefinition'];
} }

View File

@ -67,7 +67,7 @@ class MappingException extends \Doctrine\ORM\ORMException
{ {
return new self("No mapping file found named '$fileName' for class '$entityName'."); return new self("No mapping file found named '$fileName' for class '$entityName'.");
} }
public static function invalidMappingFile($entityName, $fileName) public static function invalidMappingFile($entityName, $fileName)
{ {
return new self("Invalid mapping file '$fileName' for class '$entityName'."); return new self("Invalid mapping file '$fileName' for class '$entityName'.");

View File

@ -21,7 +21,7 @@ namespace Doctrine\ORM;
/** /**
* Exception thrown when an ORM query unexpectedly does not return any results. * Exception thrown when an ORM query unexpectedly does not return any results.
* *
* @author robo * @author robo
* @since 2.0 * @since 2.0
*/ */

View File

@ -21,7 +21,7 @@ namespace Doctrine\ORM;
/** /**
* Exception thrown when an ORM query unexpectedly returns more than one result. * Exception thrown when an ORM query unexpectedly returns more than one result.
* *
* @author robo * @author robo
* @since 2.0 * @since 2.0
*/ */

View File

@ -144,7 +144,7 @@ class ORMException extends Exception
return new self("Invalid repository class '".$className."'. ". return new self("Invalid repository class '".$className."'. ".
"it must be a Doctrine\ORM\EntityRepository."); "it must be a Doctrine\ORM\EntityRepository.");
} }
public static function missingIdentifierField($className, $fieldName) public static function missingIdentifierField($className, $fieldName)
{ {
return new self("The identifier $fieldName is missing for a query of " . $className); return new self("The identifier $fieldName is missing for a query of " . $className);

View File

@ -65,11 +65,11 @@ abstract class AbstractCollectionPersister
public function delete(PersistentCollection $coll) public function delete(PersistentCollection $coll)
{ {
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
if ( ! $mapping['isOwningSide']) { if ( ! $mapping['isOwningSide']) {
return; // ignore inverse side return; // ignore inverse side
} }
$sql = $this->_getDeleteSQL($coll); $sql = $this->_getDeleteSQL($coll);
$this->_conn->executeUpdate($sql, $this->_getDeleteSQLParameters($coll)); $this->_conn->executeUpdate($sql, $this->_getDeleteSQLParameters($coll));
} }
@ -98,34 +98,34 @@ abstract class AbstractCollectionPersister
public function update(PersistentCollection $coll) public function update(PersistentCollection $coll)
{ {
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
if ( ! $mapping['isOwningSide']) { if ( ! $mapping['isOwningSide']) {
return; // ignore inverse side return; // ignore inverse side
} }
$this->deleteRows($coll); $this->deleteRows($coll);
//$this->updateRows($coll); //$this->updateRows($coll);
$this->insertRows($coll); $this->insertRows($coll);
} }
public function deleteRows(PersistentCollection $coll) public function deleteRows(PersistentCollection $coll)
{ {
$deleteDiff = $coll->getDeleteDiff(); $deleteDiff = $coll->getDeleteDiff();
$sql = $this->_getDeleteRowSQL($coll); $sql = $this->_getDeleteRowSQL($coll);
foreach ($deleteDiff as $element) { foreach ($deleteDiff as $element) {
$this->_conn->executeUpdate($sql, $this->_getDeleteRowSQLParameters($coll, $element)); $this->_conn->executeUpdate($sql, $this->_getDeleteRowSQLParameters($coll, $element));
} }
} }
//public function updateRows(PersistentCollection $coll) //public function updateRows(PersistentCollection $coll)
//{} //{}
public function insertRows(PersistentCollection $coll) public function insertRows(PersistentCollection $coll)
{ {
$insertDiff = $coll->getInsertDiff(); $insertDiff = $coll->getInsertDiff();
$sql = $this->_getInsertRowSQL($coll); $sql = $this->_getInsertRowSQL($coll);
foreach ($insertDiff as $element) { foreach ($insertDiff as $element) {
$this->_conn->executeUpdate($sql, $this->_getInsertRowSQLParameters($coll, $element)); $this->_conn->executeUpdate($sql, $this->_getInsertRowSQLParameters($coll, $element));
} }
@ -168,7 +168,7 @@ abstract class AbstractCollectionPersister
/** /**
* Gets the SQL statement used for deleting a row from the collection. * Gets the SQL statement used for deleting a row from the collection.
* *
* @param PersistentCollection $coll * @param PersistentCollection $coll
*/ */
abstract protected function _getDeleteRowSQL(PersistentCollection $coll); abstract protected function _getDeleteRowSQL(PersistentCollection $coll);

View File

@ -26,7 +26,7 @@ use Doctrine\ORM\Mapping\ClassMetadata,
* Base class for entity persisters that implement a certain inheritance mapping strategy. * Base class for entity persisters that implement a certain inheritance mapping strategy.
* All these persisters are assumed to use a discriminator column to discriminate entity * All these persisters are assumed to use a discriminator column to discriminate entity
* types in the hierarchy. * types in the hierarchy.
* *
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
* @since 2.0 * @since 2.0
@ -39,18 +39,18 @@ abstract class AbstractEntityInheritancePersister extends BasicEntityPersister
protected function _prepareInsertData($entity) protected function _prepareInsertData($entity)
{ {
$data = parent::_prepareInsertData($entity); $data = parent::_prepareInsertData($entity);
// Populate the discriminator column // Populate the discriminator column
$discColumn = $this->_class->discriminatorColumn; $discColumn = $this->_class->discriminatorColumn;
$this->_columnTypes[$discColumn['name']] = $discColumn['type']; $this->_columnTypes[$discColumn['name']] = $discColumn['type'];
$data[$this->_getDiscriminatorColumnTableName()][$discColumn['name']] = $this->_class->discriminatorValue; $data[$this->_getDiscriminatorColumnTableName()][$discColumn['name']] = $this->_class->discriminatorValue;
return $data; return $data;
} }
/** /**
* Gets the name of the table that contains the discriminator column. * Gets the name of the table that contains the discriminator column.
* *
* @return string The table name. * @return string The table name.
*/ */
abstract protected function _getDiscriminatorColumnTableName(); abstract protected function _getDiscriminatorColumnTableName();
@ -77,7 +77,7 @@ abstract class AbstractEntityInheritancePersister extends BasicEntityPersister
{ {
$columnAlias = $this->getSQLColumnAlias($joinColumnName); $columnAlias = $this->getSQLColumnAlias($joinColumnName);
$this->_rsm->addMetaResult('r', $columnAlias, $joinColumnName); $this->_rsm->addMetaResult('r', $columnAlias, $joinColumnName);
return $tableAlias . '.' . $joinColumnName . ' AS ' . $columnAlias; return $tableAlias . '.' . $joinColumnName . ' AS ' . $columnAlias;
} }
} }

View File

@ -341,7 +341,7 @@ class BasicEntityPersister
foreach ($updateData as $columnName => $value) { foreach ($updateData as $columnName => $value) {
$column = $columnName; $column = $columnName;
$placeholder = '?'; $placeholder = '?';
if (isset($this->_class->fieldNames[$columnName])) { if (isset($this->_class->fieldNames[$columnName])) {
$column = $this->_class->getQuotedColumnName($this->_class->fieldNames[$columnName], $this->_platform); $column = $this->_class->getQuotedColumnName($this->_class->fieldNames[$columnName], $this->_platform);
@ -1307,7 +1307,7 @@ class BasicEntityPersister
foreach ($criteria as $field => $value) { foreach ($criteria as $field => $value) {
$conditionSql .= $conditionSql ? ' AND ' : ''; $conditionSql .= $conditionSql ? ' AND ' : '';
$placeholder = '?'; $placeholder = '?';
if (isset($this->_class->columnNames[$field])) { if (isset($this->_class->columnNames[$field])) {

View File

@ -44,8 +44,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
{ {
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
$class = $this->_em->getClassMetadata(get_class($coll->getOwner())); $class = $this->_em->getClassMetadata(get_class($coll->getOwner()));
return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()) return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform())
. ' WHERE ' . implode(' = ? AND ', $mapping['joinTableColumns']) . ' = ?'; . ' WHERE ' . implode(' = ? AND ', $mapping['joinTableColumns']) . ' = ?';
} }
@ -81,9 +81,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
$columns = $mapping['joinTableColumns']; $columns = $mapping['joinTableColumns'];
$class = $this->_em->getClassMetadata(get_class($coll->getOwner())); $class = $this->_em->getClassMetadata(get_class($coll->getOwner()));
$joinTable = $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()); $joinTable = $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform());
return 'INSERT INTO ' . $joinTable . ' (' . implode(', ', $columns) . ')' return 'INSERT INTO ' . $joinTable . ' (' . implode(', ', $columns) . ')'
. ' VALUES (' . implode(', ', array_fill(0, count($columns), '?')) . ')'; . ' VALUES (' . implode(', ', array_fill(0, count($columns), '?')) . ')';
} }
@ -124,19 +124,19 @@ class ManyToManyPersister extends AbstractCollectionPersister
foreach ($mapping['joinTableColumns'] as $joinTableColumn) { foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
$isRelationToSource = isset($mapping['relationToSourceKeyColumns'][$joinTableColumn]); $isRelationToSource = isset($mapping['relationToSourceKeyColumns'][$joinTableColumn]);
if ( ! $isComposite) { if ( ! $isComposite) {
$params[] = $isRelationToSource ? array_pop($identifier1) : array_pop($identifier2); $params[] = $isRelationToSource ? array_pop($identifier1) : array_pop($identifier2);
continue; continue;
} }
if ($isRelationToSource) { if ($isRelationToSource) {
$params[] = $identifier1[$class1->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])]; $params[] = $identifier1[$class1->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])];
continue; continue;
} }
$params[] = $identifier2[$class2->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])]; $params[] = $identifier2[$class2->getFieldForColumn($mapping['relationToTargetKeyColumns'][$joinTableColumn])];
} }
@ -152,8 +152,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
{ {
$class = $this->_em->getClassMetadata(get_class($coll->getOwner())); $class = $this->_em->getClassMetadata(get_class($coll->getOwner()));
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()) return 'DELETE FROM ' . $class->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform())
. ' WHERE ' . implode(' = ? AND ', array_keys($mapping['relationToSourceKeyColumns'])) . ' = ?'; . ' WHERE ' . implode(' = ? AND ', array_keys($mapping['relationToSourceKeyColumns'])) . ' = ?';
} }
@ -169,21 +169,21 @@ class ManyToManyPersister extends AbstractCollectionPersister
$identifier = $this->_uow->getEntityIdentifier($coll->getOwner()); $identifier = $this->_uow->getEntityIdentifier($coll->getOwner());
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
$params = array(); $params = array();
// Optimization for single column identifier // Optimization for single column identifier
if (count($mapping['relationToSourceKeyColumns']) === 1) { if (count($mapping['relationToSourceKeyColumns']) === 1) {
$params[] = array_pop($identifier); $params[] = array_pop($identifier);
return $params; return $params;
} }
// Composite identifier // Composite identifier
$sourceClass = $this->_em->getClassMetadata(get_class($mapping->getOwner())); $sourceClass = $this->_em->getClassMetadata(get_class($mapping->getOwner()));
foreach ($mapping['relationToSourceKeyColumns'] as $relColumn => $srcColumn) { foreach ($mapping['relationToSourceKeyColumns'] as $relColumn => $srcColumn) {
$params[] = $identifier[$sourceClass->fieldNames[$srcColumn]]; $params[] = $identifier[$sourceClass->fieldNames[$srcColumn]];
} }
return $params; return $params;
} }
@ -205,12 +205,12 @@ class ManyToManyPersister extends AbstractCollectionPersister
$whereClauses = array(); $whereClauses = array();
$params = array(); $params = array();
foreach ($mapping['joinTableColumns'] as $joinTableColumn) { foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
if ( ! isset($joinColumns[$joinTableColumn])) { if ( ! isset($joinColumns[$joinTableColumn])) {
continue; continue;
} }
$whereClauses[] = $joinTableColumn . ' = ?'; $whereClauses[] = $joinTableColumn . ' = ?';
$params[] = ($class->containsForeignIdentifier) $params[] = ($class->containsForeignIdentifier)
@ -240,7 +240,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
public function slice(PersistentCollection $coll, $offset, $length = null) public function slice(PersistentCollection $coll, $offset, $length = null)
{ {
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
return $this->_em->getUnitOfWork()->getEntityPersister($mapping['targetEntity'])->getManyToManyCollection($mapping, $coll->getOwner(), $offset, $length); return $this->_em->getUnitOfWork()->getEntityPersister($mapping['targetEntity'])->getManyToManyCollection($mapping, $coll->getOwner(), $offset, $length);
} }
@ -259,12 +259,12 @@ class ManyToManyPersister extends AbstractCollectionPersister
} }
list($quotedJoinTable, $whereClauses, $params) = $this->getJoinTableRestrictions($coll, $element, true); list($quotedJoinTable, $whereClauses, $params) = $this->getJoinTableRestrictions($coll, $element, true);
$sql = 'SELECT 1 FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses); $sql = 'SELECT 1 FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses);
return (bool) $this->_conn->fetchColumn($sql, $params); return (bool) $this->_conn->fetchColumn($sql, $params);
} }
/** /**
* @param PersistentCollection $coll * @param PersistentCollection $coll
* @param object $element * @param object $element
@ -282,10 +282,10 @@ class ManyToManyPersister extends AbstractCollectionPersister
list($quotedJoinTable, $whereClauses, $params) = $this->getJoinTableRestrictions($coll, $element, false); list($quotedJoinTable, $whereClauses, $params) = $this->getJoinTableRestrictions($coll, $element, false);
$sql = 'DELETE FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses); $sql = 'DELETE FROM ' . $quotedJoinTable . ' WHERE ' . implode(' AND ', $whereClauses);
return (bool) $this->_conn->executeUpdate($sql, $params); return (bool) $this->_conn->executeUpdate($sql, $params);
} }
/** /**
* @param \Doctrine\ORM\PersistentCollection $coll * @param \Doctrine\ORM\PersistentCollection $coll
* @param object $element * @param object $element
@ -296,13 +296,13 @@ class ManyToManyPersister extends AbstractCollectionPersister
{ {
$uow = $this->_em->getUnitOfWork(); $uow = $this->_em->getUnitOfWork();
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
if ( ! $mapping['isOwningSide']) { if ( ! $mapping['isOwningSide']) {
$sourceClass = $this->_em->getClassMetadata($mapping['targetEntity']); $sourceClass = $this->_em->getClassMetadata($mapping['targetEntity']);
$targetClass = $this->_em->getClassMetadata($mapping['sourceEntity']); $targetClass = $this->_em->getClassMetadata($mapping['sourceEntity']);
$sourceId = $uow->getEntityIdentifier($element); $sourceId = $uow->getEntityIdentifier($element);
$targetId = $uow->getEntityIdentifier($coll->getOwner()); $targetId = $uow->getEntityIdentifier($coll->getOwner());
$mapping = $sourceClass->associationMappings[$mapping['mappedBy']]; $mapping = $sourceClass->associationMappings[$mapping['mappedBy']];
} else { } else {
$sourceClass = $this->_em->getClassMetadata($mapping['sourceEntity']); $sourceClass = $this->_em->getClassMetadata($mapping['sourceEntity']);
@ -310,11 +310,11 @@ class ManyToManyPersister extends AbstractCollectionPersister
$sourceId = $uow->getEntityIdentifier($coll->getOwner()); $sourceId = $uow->getEntityIdentifier($coll->getOwner());
$targetId = $uow->getEntityIdentifier($element); $targetId = $uow->getEntityIdentifier($element);
} }
$quotedJoinTable = $sourceClass->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform()); $quotedJoinTable = $sourceClass->getQuotedJoinTableName($mapping, $this->_conn->getDatabasePlatform());
$whereClauses = array(); $whereClauses = array();
$params = array(); $params = array();
foreach ($mapping['joinTableColumns'] as $joinTableColumn) { foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
$whereClauses[] = $joinTableColumn . ' = ?'; $whereClauses[] = $joinTableColumn . ' = ?';
@ -324,7 +324,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
: $targetId[$targetClass->fieldNames[$mapping['relationToTargetKeyColumns'][$joinTableColumn]]]; : $targetId[$targetClass->fieldNames[$mapping['relationToTargetKeyColumns'][$joinTableColumn]]];
continue; continue;
} }
// relationToSourceKeyColumns // relationToSourceKeyColumns
$params[] = ($sourceClass->containsForeignIdentifier) $params[] = ($sourceClass->containsForeignIdentifier)
? $sourceId[$sourceClass->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])] ? $sourceId[$sourceClass->getFieldForColumn($mapping['relationToSourceKeyColumns'][$joinTableColumn])]
@ -338,7 +338,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
$whereClauses[] = $filterSql; $whereClauses[] = $filterSql;
} }
} }
return array($quotedJoinTable, $whereClauses, $params); return array($quotedJoinTable, $whereClauses, $params);
} }

View File

@ -44,14 +44,14 @@ class OneToManyPersister extends AbstractCollectionPersister
{ {
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
$class = $this->_em->getClassMetadata($mapping['targetEntity']); $class = $this->_em->getClassMetadata($mapping['targetEntity']);
return 'DELETE FROM ' . $class->getQuotedTableName($this->_conn->getDatabasePlatform()) return 'DELETE FROM ' . $class->getQuotedTableName($this->_conn->getDatabasePlatform())
. ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?'; . ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?';
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
*/ */
protected function _getDeleteRowSQLParameters(PersistentCollection $coll, $element) protected function _getDeleteRowSQLParameters(PersistentCollection $coll, $element)
{ {
@ -110,10 +110,10 @@ class OneToManyPersister extends AbstractCollectionPersister
$whereClauses = array(); $whereClauses = array();
$params = array(); $params = array();
foreach ($targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'] AS $joinColumn) { foreach ($targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'] AS $joinColumn) {
$whereClauses[] = $joinColumn['name'] . ' = ?'; $whereClauses[] = $joinColumn['name'] . ' = ?';
$params[] = ($targetClass->containsForeignIdentifier) $params[] = ($targetClass->containsForeignIdentifier)
? $id[$sourceClass->getFieldForColumn($joinColumn['referencedColumnName'])] ? $id[$sourceClass->getFieldForColumn($joinColumn['referencedColumnName'])]
: $id[$sourceClass->fieldNames[$joinColumn['referencedColumnName']]]; : $id[$sourceClass->fieldNames[$joinColumn['referencedColumnName']]];
@ -143,7 +143,7 @@ class OneToManyPersister extends AbstractCollectionPersister
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
$uow = $this->_em->getUnitOfWork(); $uow = $this->_em->getUnitOfWork();
$persister = $uow->getEntityPersister($mapping['targetEntity']); $persister = $uow->getEntityPersister($mapping['targetEntity']);
return $persister->getOneToManyCollection($mapping, $coll->getOwner(), $offset, $length); return $persister->getOneToManyCollection($mapping, $coll->getOwner(), $offset, $length);
} }
@ -156,22 +156,22 @@ class OneToManyPersister extends AbstractCollectionPersister
{ {
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
$uow = $this->_em->getUnitOfWork(); $uow = $this->_em->getUnitOfWork();
// shortcut for new entities // shortcut for new entities
if ($uow->getEntityState($element, UnitOfWork::STATE_NEW) == UnitOfWork::STATE_NEW) { if ($uow->getEntityState($element, UnitOfWork::STATE_NEW) == UnitOfWork::STATE_NEW) {
return false; return false;
} }
$persister = $uow->getEntityPersister($mapping['targetEntity']); $persister = $uow->getEntityPersister($mapping['targetEntity']);
// only works with single id identifier entities. Will throw an // only works with single id identifier entities. Will throw an
// exception in Entity Persisters if that is not the case for the // exception in Entity Persisters if that is not the case for the
// 'mappedBy' field. // 'mappedBy' field.
$id = current( $uow->getEntityIdentifier($coll->getOwner()) ); $id = current( $uow->getEntityIdentifier($coll->getOwner()) );
return $persister->exists($element, array($mapping['mappedBy'] => $id)); return $persister->exists($element, array($mapping['mappedBy'] => $id));
} }
/** /**
* @param PersistentCollection $coll * @param PersistentCollection $coll
* @param object $element * @param object $element
@ -190,7 +190,7 @@ class OneToManyPersister extends AbstractCollectionPersister
$class = $this->_em->getClassMetadata($mapping['targetEntity']); $class = $this->_em->getClassMetadata($mapping['targetEntity']);
$sql = 'DELETE FROM ' . $class->getQuotedTableName($this->_conn->getDatabasePlatform()) $sql = 'DELETE FROM ' . $class->getQuotedTableName($this->_conn->getDatabasePlatform())
. ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?'; . ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?';
return (bool) $this->_conn->executeUpdate($sql, $this->_getDeleteRowSQLParameters($coll, $element)); return (bool) $this->_conn->executeUpdate($sql, $this->_getDeleteRowSQLParameters($coll, $element));
} }
} }

View File

@ -51,33 +51,33 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
// Append discriminator column // Append discriminator column
$discrColumn = $this->_class->discriminatorColumn['name']; $discrColumn = $this->_class->discriminatorColumn['name'];
$columnList .= ', ' . $discrColumn; $columnList .= ', ' . $discrColumn;
$rootClass = $this->_em->getClassMetadata($this->_class->rootEntityName); $rootClass = $this->_em->getClassMetadata($this->_class->rootEntityName);
$tableAlias = $this->_getSQLTableAlias($rootClass->name); $tableAlias = $this->_getSQLTableAlias($rootClass->name);
$resultColumnName = $this->_platform->getSQLResultCasing($discrColumn); $resultColumnName = $this->_platform->getSQLResultCasing($discrColumn);
$this->_rsm->setDiscriminatorColumn('r', $resultColumnName); $this->_rsm->setDiscriminatorColumn('r', $resultColumnName);
$this->_rsm->addMetaResult('r', $resultColumnName, $discrColumn); $this->_rsm->addMetaResult('r', $resultColumnName, $discrColumn);
// Append subclass columns // Append subclass columns
foreach ($this->_class->subClasses as $subClassName) { foreach ($this->_class->subClasses as $subClassName) {
$subClass = $this->_em->getClassMetadata($subClassName); $subClass = $this->_em->getClassMetadata($subClassName);
// Regular columns // Regular columns
foreach ($subClass->fieldMappings as $fieldName => $mapping) { foreach ($subClass->fieldMappings as $fieldName => $mapping) {
if ( ! isset($mapping['inherited'])) { if ( ! isset($mapping['inherited'])) {
$columnList .= ', ' . $this->_getSelectColumnSQL($fieldName, $subClass); $columnList .= ', ' . $this->_getSelectColumnSQL($fieldName, $subClass);
} }
} }
// Foreign key columns // Foreign key columns
foreach ($subClass->associationMappings as $assoc) { foreach ($subClass->associationMappings as $assoc) {
if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE && ! isset($assoc['inherited'])) { if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE && ! isset($assoc['inherited'])) {
foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) { foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) {
if ($columnList != '') $columnList .= ', '; if ($columnList != '') $columnList .= ', ';
$columnList .= $this->getSelectJoinColumnSQL( $columnList .= $this->getSelectJoinColumnSQL(
$tableAlias, $tableAlias,
$srcColumn, $srcColumn,
isset($assoc['inherited']) ? $assoc['inherited'] : $this->_class->name isset($assoc['inherited']) ? $assoc['inherited'] : $this->_class->name
); );
@ -94,7 +94,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
protected function _getInsertColumnList() protected function _getInsertColumnList()
{ {
$columns = parent::_getInsertColumnList(); $columns = parent::_getInsertColumnList();
// Add discriminator column to the INSERT SQL // Add discriminator column to the INSERT SQL
$columns[] = $this->_class->discriminatorColumn['name']; $columns[] = $this->_class->discriminatorColumn['name'];
@ -114,19 +114,19 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
// Append discriminator condition // Append discriminator condition
if ($conditionSql) $conditionSql .= ' AND '; if ($conditionSql) $conditionSql .= ' AND ';
$values = array(); $values = array();
if ($this->_class->discriminatorValue !== null) { // discriminators can be 0 if ($this->_class->discriminatorValue !== null) { // discriminators can be 0
$values[] = $this->_conn->quote($this->_class->discriminatorValue); $values[] = $this->_conn->quote($this->_class->discriminatorValue);
} }
$discrValues = array_flip($this->_class->discriminatorMap); $discrValues = array_flip($this->_class->discriminatorMap);
foreach ($this->_class->subClasses as $subclassName) { foreach ($this->_class->subClasses as $subclassName) {
$values[] = $this->_conn->quote($discrValues[$subclassName]); $values[] = $this->_conn->quote($discrValues[$subclassName]);
} }
$conditionSql .= $this->_getSQLTableAlias($this->_class->name) . '.' . $this->_class->discriminatorColumn['name'] $conditionSql .= $this->_getSQLTableAlias($this->_class->name) . '.' . $this->_class->discriminatorColumn['name']
. ' IN (' . implode(', ', $values) . ')'; . ' IN (' . implode(', ', $values) . ')';

View File

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

View File

@ -23,7 +23,7 @@ namespace Doctrine\ORM\Proxy;
/** /**
* Interface for proxy classes. * Interface for proxy classes.
* *
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0 * @since 2.0
*/ */

View File

@ -640,7 +640,7 @@ final class Query extends AbstractQuery
public function __clone() public function __clone()
{ {
parent::__clone(); parent::__clone();
$this->_state = self::STATE_DIRTY; $this->_state = self::STATE_DIRTY;
} }
} }

View File

@ -38,7 +38,7 @@ class ArithmeticFactor extends Node
* @var ArithmeticPrimary * @var ArithmeticPrimary
*/ */
public $arithmeticPrimary; public $arithmeticPrimary;
/** /**
* @var null|boolean NULL represents no sign, TRUE means positive and FALSE means negative sign * @var null|boolean NULL represents no sign, TRUE means positive and FALSE means negative sign
*/ */

View File

@ -33,13 +33,13 @@ namespace Doctrine\ORM\Query\AST;
class CoalesceExpression extends Node class CoalesceExpression extends Node
{ {
public $scalarExpressions = array(); public $scalarExpressions = array();
public function __construct(array $scalarExpressions) public function __construct(array $scalarExpressions)
{ {
$this->scalarExpressions = $scalarExpressions; $this->scalarExpressions = $scalarExpressions;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkCoalesceExpression($this); return $sqlWalker->walkCoalesceExpression($this);

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>. * <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**

View File

@ -41,7 +41,7 @@ class DeleteStatement extends Node
{ {
$this->deleteClause = $deleteClause; $this->deleteClause = $deleteClause;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkDeleteStatement($this); return $sqlWalker->walkDeleteStatement($this);

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>. * <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**

View File

@ -36,8 +36,8 @@ class FromClause extends Node
public function __construct(array $identificationVariableDeclarations) public function __construct(array $identificationVariableDeclarations)
{ {
$this->identificationVariableDeclarations = $identificationVariableDeclarations; $this->identificationVariableDeclarations = $identificationVariableDeclarations;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkFromClause($this); return $sqlWalker->walkFromClause($this);

View File

@ -53,9 +53,9 @@ class AbsFunction extends FunctionNode
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -16,7 +16,7 @@
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>. * <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
use Doctrine\ORM\Query\Lexer; use Doctrine\ORM\Query\Lexer;

View File

@ -42,13 +42,13 @@ class IdentityFunction extends FunctionNode
$platform = $sqlWalker->getConnection()->getDatabasePlatform(); $platform = $sqlWalker->getConnection()->getDatabasePlatform();
$dqlAlias = $this->pathExpression->identificationVariable; $dqlAlias = $this->pathExpression->identificationVariable;
$assocField = $this->pathExpression->field; $assocField = $this->pathExpression->field;
$qComp = $sqlWalker->getQueryComponent($dqlAlias); $qComp = $sqlWalker->getQueryComponent($dqlAlias);
$class = $qComp['metadata']; $class = $qComp['metadata'];
$assoc = $class->associationMappings[$assocField]; $assoc = $class->associationMappings[$assocField];
$tableAlias = $sqlWalker->getSQLTableAlias($class->getTableName(), $dqlAlias); $tableAlias = $sqlWalker->getSQLTableAlias($class->getTableName(), $dqlAlias);
return $tableAlias . '.' . reset($assoc['targetToSourceKeyColumns']);; return $tableAlias . '.' . reset($assoc['targetToSourceKeyColumns']);;
} }
@ -59,9 +59,9 @@ class IdentityFunction extends FunctionNode
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->pathExpression = $parser->SingleValuedAssociationPathExpression(); $this->pathExpression = $parser->SingleValuedAssociationPathExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -53,9 +53,9 @@ class LengthFunction extends FunctionNode
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->stringPrimary = $parser->StringPrimary(); $this->stringPrimary = $parser->StringPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -61,20 +61,20 @@ class LocateFunction extends FunctionNode
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->firstStringPrimary = $parser->StringPrimary(); $this->firstStringPrimary = $parser->StringPrimary();
$parser->match(Lexer::T_COMMA); $parser->match(Lexer::T_COMMA);
$this->secondStringPrimary = $parser->StringPrimary(); $this->secondStringPrimary = $parser->StringPrimary();
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
if ($lexer->isNextToken(Lexer::T_COMMA)) { if ($lexer->isNextToken(Lexer::T_COMMA)) {
$parser->match(Lexer::T_COMMA); $parser->match(Lexer::T_COMMA);
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
} }
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -53,9 +53,9 @@ class LowerFunction extends FunctionNode
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->stringPrimary = $parser->StringPrimary(); $this->stringPrimary = $parser->StringPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -55,13 +55,13 @@ class ModFunction extends FunctionNode
{ {
$parser->match(Lexer::T_MOD); $parser->match(Lexer::T_MOD);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(Lexer::T_COMMA); $parser->match(Lexer::T_COMMA);
$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -45,7 +45,7 @@ class SizeFunction extends FunctionNode
$platform = $sqlWalker->getConnection()->getDatabasePlatform(); $platform = $sqlWalker->getConnection()->getDatabasePlatform();
$dqlAlias = $this->collectionPathExpression->identificationVariable; $dqlAlias = $this->collectionPathExpression->identificationVariable;
$assocField = $this->collectionPathExpression->field; $assocField = $this->collectionPathExpression->field;
$qComp = $sqlWalker->getQueryComponent($dqlAlias); $qComp = $sqlWalker->getQueryComponent($dqlAlias);
$class = $qComp['metadata']; $class = $qComp['metadata'];
$assoc = $class->associationMappings[$assocField]; $assoc = $class->associationMappings[$assocField];
@ -61,7 +61,7 @@ class SizeFunction extends FunctionNode
$owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']]; $owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']];
$first = true; $first = true;
foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) { foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) {
if ($first) $first = false; else $sql .= ' AND '; if ($first) $first = false; else $sql .= ' AND ';
@ -100,7 +100,7 @@ class SizeFunction extends FunctionNode
. $sourceTableAlias . '.' . $sourceColumnName; . $sourceTableAlias . '.' . $sourceColumnName;
} }
} }
return '(' . $sql . ')'; return '(' . $sql . ')';
} }
@ -110,12 +110,12 @@ class SizeFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match(Lexer::T_SIZE); $parser->match(Lexer::T_SIZE);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->collectionPathExpression = $parser->CollectionValuedPathExpression(); $this->collectionPathExpression = $parser->CollectionValuedPathExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -52,9 +52,9 @@ class SqrtFunction extends FunctionNode
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -64,15 +64,15 @@ class SubstringFunction extends FunctionNode
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->stringPrimary = $parser->StringPrimary(); $this->stringPrimary = $parser->StringPrimary();
$parser->match(Lexer::T_COMMA); $parser->match(Lexer::T_COMMA);
$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
if ($lexer->isNextToken(Lexer::T_COMMA)) { if ($lexer->isNextToken(Lexer::T_COMMA)) {
$parser->match(Lexer::T_COMMA); $parser->match(Lexer::T_COMMA);
$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
} }

View File

@ -53,9 +53,9 @@ class UpperFunction extends FunctionNode
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->stringPrimary = $parser->StringPrimary(); $this->stringPrimary = $parser->StringPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
} }

View File

@ -20,7 +20,7 @@
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* GeneralCaseExpression ::= "CASE" WhenClause {WhenClause}* "ELSE" ScalarExpression "END" * GeneralCaseExpression ::= "CASE" WhenClause {WhenClause}* "ELSE" ScalarExpression "END"
* *
* @since 2.2 * @since 2.2
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
@ -39,8 +39,8 @@ class GeneralCaseExpression extends Node
{ {
$this->whenClauses = $whenClauses; $this->whenClauses = $whenClauses;
$this->elseScalarExpression = $elseScalarExpression; $this->elseScalarExpression = $elseScalarExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkGeneralCaseExpression($this); return $sqlWalker->walkGeneralCaseExpression($this);

View File

@ -44,7 +44,7 @@ class IdentificationVariableDeclaration extends Node
$this->indexBy = $indexBy; $this->indexBy = $indexBy;
$this->joinVariableDeclarations = $joinVariableDecls; $this->joinVariableDeclarations = $joinVariableDecls;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkIdentificationVariableDeclaration($this); return $sqlWalker->walkIdentificationVariableDeclaration($this);

View File

@ -39,8 +39,8 @@ class IndexBy extends Node
public function __construct($simpleStateFieldPathExpression) public function __construct($simpleStateFieldPathExpression)
{ {
$this->simpleStateFieldPathExpression = $simpleStateFieldPathExpression; $this->simpleStateFieldPathExpression = $simpleStateFieldPathExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkIndexBy($this); return $sqlWalker->walkIndexBy($this);

View File

@ -36,7 +36,7 @@ class InstanceOfExpression extends Node
public $not; public $not;
public $identificationVariable; public $identificationVariable;
public $value; public $value;
public function __construct($identVariable) public function __construct($identVariable)
{ {
$this->identificationVariable = $identVariable; $this->identificationVariable = $identVariable;

View File

@ -39,7 +39,7 @@ class Join extends Node
const JOIN_TYPE_LEFTOUTER = 2; const JOIN_TYPE_LEFTOUTER = 2;
const JOIN_TYPE_INNER = 3; const JOIN_TYPE_INNER = 3;
public $joinType = self::JOIN_TYPE_INNER; public $joinType = self::JOIN_TYPE_INNER;
public $joinAssociationPathExpression = null; public $joinAssociationPathExpression = null;
public $aliasIdentificationVariable = null; public $aliasIdentificationVariable = null;
public $conditionalExpression = null; public $conditionalExpression = null;
@ -50,7 +50,7 @@ class Join extends Node
$this->joinAssociationPathExpression = $joinAssocPathExpr; $this->joinAssociationPathExpression = $joinAssocPathExpr;
$this->aliasIdentificationVariable = $aliasIdentVar; $this->aliasIdentificationVariable = $aliasIdentVar;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkJoin($this); return $sqlWalker->walkJoin($this);

View File

@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>. * <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**

View File

@ -42,7 +42,7 @@ class JoinVariableDeclaration extends Node
$this->join = $join; $this->join = $join;
$this->indexBy = $indexBy; $this->indexBy = $indexBy;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkJoinVariableDeclaration($this); return $sqlWalker->walkJoinVariableDeclaration($this);

View File

@ -7,16 +7,16 @@ class Literal extends Node
const STRING = 1; const STRING = 1;
const BOOLEAN = 2; const BOOLEAN = 2;
const NUMERIC = 3; const NUMERIC = 3;
public $type; public $type;
public $value; public $value;
public function __construct($type, $value) public function __construct($type, $value)
{ {
$this->type = $type; $this->type = $type;
$this->value = $value; $this->value = $value;
} }
public function dispatch($walker) public function dispatch($walker)
{ {
return $walker->walkLiteral($this); return $walker->walkLiteral($this);

View File

@ -36,16 +36,16 @@ abstract class Node
{ {
/** /**
* Double-dispatch method, supposed to dispatch back to the walker. * Double-dispatch method, supposed to dispatch back to the walker.
* *
* Implementation is not mandatory for all nodes. * Implementation is not mandatory for all nodes.
* *
* @param $walker * @param $walker
*/ */
public function dispatch($walker) public function dispatch($walker)
{ {
throw ASTException::noDispatchForNode($this); throw ASTException::noDispatchForNode($this);
} }
/** /**
* Dumps the AST Node into a string representation for information purpose only * Dumps the AST Node into a string representation for information purpose only
* *
@ -55,36 +55,36 @@ abstract class Node
{ {
return $this->dump($this); return $this->dump($this);
} }
public function dump($obj) public function dump($obj)
{ {
static $ident = 0; static $ident = 0;
$str = ''; $str = '';
if ($obj instanceof Node) { if ($obj instanceof Node) {
$str .= get_class($obj) . '(' . PHP_EOL; $str .= get_class($obj) . '(' . PHP_EOL;
$props = get_object_vars($obj); $props = get_object_vars($obj);
foreach ($props as $name => $prop) { foreach ($props as $name => $prop) {
$ident += 4; $ident += 4;
$str .= str_repeat(' ', $ident) . '"' . $name . '": ' $str .= str_repeat(' ', $ident) . '"' . $name . '": '
. $this->dump($prop) . ',' . PHP_EOL; . $this->dump($prop) . ',' . PHP_EOL;
$ident -= 4; $ident -= 4;
} }
$str .= str_repeat(' ', $ident) . ')'; $str .= str_repeat(' ', $ident) . ')';
} else if (is_array($obj)) { } else if (is_array($obj)) {
$ident += 4; $ident += 4;
$str .= 'array('; $str .= 'array(';
$some = false; $some = false;
foreach ($obj as $k => $v) { foreach ($obj as $k => $v) {
$str .= PHP_EOL . str_repeat(' ', $ident) . '"' $str .= PHP_EOL . str_repeat(' ', $ident) . '"'
. $k . '" => ' . $this->dump($v) . ','; . $k . '" => ' . $this->dump($v) . ',';
$some = true; $some = true;
} }
$ident -= 4; $ident -= 4;
$str .= ($some ? PHP_EOL . str_repeat(' ', $ident) : '') . ')'; $str .= ($some ? PHP_EOL . str_repeat(' ', $ident) : '') . ')';
} else if (is_object($obj)) { } else if (is_object($obj)) {
@ -92,7 +92,7 @@ abstract class Node
} else { } else {
$str .= var_export($obj, true); $str .= var_export($obj, true);
} }
return $str; return $str;
} }
} }

View File

@ -36,7 +36,7 @@ class NullComparisonExpression extends Node
{ {
public $not; public $not;
public $expression; public $expression;
public function __construct($expression) public function __construct($expression)
{ {
$this->expression = $expression; $this->expression = $expression;

View File

@ -33,15 +33,15 @@ namespace Doctrine\ORM\Query\AST;
class NullIfExpression extends Node class NullIfExpression extends Node
{ {
public $firstExpression; public $firstExpression;
public $secondExpression; public $secondExpression;
public function __construct($firstExpression, $secondExpression) public function __construct($firstExpression, $secondExpression)
{ {
$this->firstExpression = $firstExpression; $this->firstExpression = $firstExpression;
$this->secondExpression = $secondExpression; $this->secondExpression = $secondExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkNullIfExpression($this); return $sqlWalker->walkNullIfExpression($this);

View File

@ -36,7 +36,7 @@ class OrderByItem extends Node
{ {
public $expression; public $expression;
public $type; public $type;
public function __construct($expression) public function __construct($expression)
{ {
$this->expression = $expression; $this->expression = $expression;

View File

@ -6,7 +6,7 @@ class PartialObjectExpression extends Node
{ {
public $identificationVariable; public $identificationVariable;
public $partialFieldSet; public $partialFieldSet;
public function __construct($identificationVariable, array $partialFieldSet) public function __construct($identificationVariable, array $partialFieldSet)
{ {
$this->identificationVariable = $identificationVariable; $this->identificationVariable = $identificationVariable;

View File

@ -16,7 +16,7 @@
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>. * <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
@ -27,7 +27,7 @@ namespace Doctrine\ORM\Query\AST;
* CollectionValuedPathExpression ::= IdentificationVariable "." CollectionValuedAssociationField * CollectionValuedPathExpression ::= IdentificationVariable "." CollectionValuedAssociationField
* StateField ::= {EmbeddedClassStateField "."}* SimpleStateField * StateField ::= {EmbeddedClassStateField "."}* SimpleStateField
* SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField * SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField
* *
* @since 2.0 * @since 2.0
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com> * @author Jonathan Wage <jonwage@gmail.com>
@ -38,19 +38,19 @@ class PathExpression extends Node
const TYPE_COLLECTION_VALUED_ASSOCIATION = 2; const TYPE_COLLECTION_VALUED_ASSOCIATION = 2;
const TYPE_SINGLE_VALUED_ASSOCIATION = 4; const TYPE_SINGLE_VALUED_ASSOCIATION = 4;
const TYPE_STATE_FIELD = 8; const TYPE_STATE_FIELD = 8;
public $type; public $type;
public $expectedType; public $expectedType;
public $identificationVariable; public $identificationVariable;
public $field; public $field;
public function __construct($expectedType, $identificationVariable, $field = null) public function __construct($expectedType, $identificationVariable, $field = null)
{ {
$this->expectedType = $expectedType; $this->expectedType = $expectedType;
$this->identificationVariable = $identificationVariable; $this->identificationVariable = $identificationVariable;
$this->field = $field; $this->field = $field;
} }
public function dispatch($walker) public function dispatch($walker)
{ {
return $walker->walkPathExpression($this); return $walker->walkPathExpression($this);

View File

@ -41,8 +41,8 @@ class RangeVariableDeclaration extends Node
{ {
$this->abstractSchemaName = $abstractSchemaName; $this->abstractSchemaName = $abstractSchemaName;
$this->aliasIdentificationVariable = $aliasIdentificationVar; $this->aliasIdentificationVariable = $aliasIdentificationVar;
} }
public function dispatch($walker) public function dispatch($walker)
{ {
return $walker->walkRangeVariableDeclaration($this); return $walker->walkRangeVariableDeclaration($this);

View File

@ -42,7 +42,7 @@ class SelectClause extends Node
$this->isDistinct = $isDistinct; $this->isDistinct = $isDistinct;
$this->selectExpressions = $selectExpressions; $this->selectExpressions = $selectExpressions;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSelectClause($this); return $sqlWalker->walkSelectClause($this);

View File

@ -44,8 +44,8 @@ class SelectExpression extends Node
$this->expression = $expression; $this->expression = $expression;
$this->fieldIdentificationVariable = $fieldIdentificationVariable; $this->fieldIdentificationVariable = $fieldIdentificationVariable;
$this->hiddenAliasResultVariable = $hiddenAliasResultVariable; $this->hiddenAliasResultVariable = $hiddenAliasResultVariable;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSelectExpression($this); return $sqlWalker->walkSelectExpression($this);

View File

@ -44,8 +44,8 @@ class SelectStatement extends Node
public function __construct($selectClause, $fromClause) { public function __construct($selectClause, $fromClause) {
$this->selectClause = $selectClause; $this->selectClause = $selectClause;
$this->fromClause = $fromClause; $this->fromClause = $fromClause;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSelectStatement($this); return $sqlWalker->walkSelectStatement($this);

View File

@ -20,7 +20,7 @@
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* SimpleCaseExpression ::= "CASE" CaseOperand SimpleWhenClause {SimpleWhenClause}* "ELSE" ScalarExpression "END" * SimpleCaseExpression ::= "CASE" CaseOperand SimpleWhenClause {SimpleWhenClause}* "ELSE" ScalarExpression "END"
* *
* @since 2.2 * @since 2.2
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
@ -41,8 +41,8 @@ class SimpleCaseExpression extends Node
$this->caseOperand = $caseOperand; $this->caseOperand = $caseOperand;
$this->simpleWhenClauses = $simpleWhenClauses; $this->simpleWhenClauses = $simpleWhenClauses;
$this->elseScalarExpression = $elseScalarExpression; $this->elseScalarExpression = $elseScalarExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSimpleCaseExpression($this); return $sqlWalker->walkSimpleCaseExpression($this);

View File

@ -42,7 +42,7 @@ class SimpleSelectClause extends Node
$this->simpleSelectExpression = $simpleSelectExpression; $this->simpleSelectExpression = $simpleSelectExpression;
$this->isDistinct = $isDistinct; $this->isDistinct = $isDistinct;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSimpleSelectClause($this); return $sqlWalker->walkSimpleSelectClause($this);

View File

@ -41,8 +41,8 @@ class SimpleSelectExpression extends Node
public function __construct($expression) public function __construct($expression)
{ {
$this->expression = $expression; $this->expression = $expression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSimpleSelectExpression($this); return $sqlWalker->walkSimpleSelectExpression($this);

View File

@ -20,7 +20,7 @@
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* SimpleWhenClause ::= "WHEN" ScalarExpression "THEN" ScalarExpression * SimpleWhenClause ::= "WHEN" ScalarExpression "THEN" ScalarExpression
* *
* @since 2.2 * @since 2.2
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
@ -39,8 +39,8 @@ class SimpleWhenClause extends Node
{ {
$this->caseScalarExpression = $caseScalarExpression; $this->caseScalarExpression = $caseScalarExpression;
$this->thenScalarExpression = $thenScalarExpression; $this->thenScalarExpression = $thenScalarExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkWhenClauseExpression($this); return $sqlWalker->walkWhenClauseExpression($this);

View File

@ -45,8 +45,8 @@ class Subselect extends Node
{ {
$this->simpleSelectClause = $simpleSelectClause; $this->simpleSelectClause = $simpleSelectClause;
$this->subselectFromClause = $subselectFromClause; $this->subselectFromClause = $subselectFromClause;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSubselect($this); return $sqlWalker->walkSubselect($this);

View File

@ -39,8 +39,8 @@ class SubselectFromClause extends Node
public function __construct(array $identificationVariableDeclarations) public function __construct(array $identificationVariableDeclarations)
{ {
$this->identificationVariableDeclarations = $identificationVariableDeclarations; $this->identificationVariableDeclarations = $identificationVariableDeclarations;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkSubselectFromClause($this); return $sqlWalker->walkSubselectFromClause($this);

View File

@ -46,4 +46,4 @@ class UpdateStatement extends Node
{ {
return $sqlWalker->walkUpdateStatement($this); return $sqlWalker->walkUpdateStatement($this);
} }
} }

View File

@ -20,7 +20,7 @@
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* WhenClause ::= "WHEN" ConditionalExpression "THEN" ScalarExpression * WhenClause ::= "WHEN" ConditionalExpression "THEN" ScalarExpression
* *
* @since 2.2 * @since 2.2
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
@ -39,8 +39,8 @@ class WhenClause extends Node
{ {
$this->caseConditionExpression = $caseConditionExpression; $this->caseConditionExpression = $caseConditionExpression;
$this->thenScalarExpression = $thenScalarExpression; $this->thenScalarExpression = $thenScalarExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
{ {
return $sqlWalker->walkWhenClauseExpression($this); return $sqlWalker->walkWhenClauseExpression($this);

View File

@ -36,7 +36,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
private $_createTempTableSql; private $_createTempTableSql;
private $_dropTempTableSql; private $_dropTempTableSql;
private $_insertSql; private $_insertSql;
/** /**
* Initializes a new <tt>MultiTableDeleteExecutor</tt>. * Initializes a new <tt>MultiTableDeleteExecutor</tt>.
* *
@ -64,7 +64,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
$this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')' $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')'
. ' SELECT t0.' . implode(', t0.', $idColumnNames); . ' SELECT t0.' . implode(', t0.', $idColumnNames);
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias); $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias);
$fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array()))); $fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array())));
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause); $this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
@ -84,7 +84,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
$this->_sqlStatements[] = 'DELETE FROM ' . $tableName $this->_sqlStatements[] = 'DELETE FROM ' . $tableName
. ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')'; . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')';
} }
// 4. Store DDL for temporary identifier table. // 4. Store DDL for temporary identifier table.
$columnDefinitions = array(); $columnDefinitions = array();
foreach ($idColumnNames as $idColumnName) { foreach ($idColumnNames as $idColumnName) {

View File

@ -80,7 +80,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
// 3. Create and store UPDATE statements // 3. Create and store UPDATE statements
$classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses); $classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses);
$i = -1; $i = -1;
foreach (array_reverse($classNames) as $className) { foreach (array_reverse($classNames) as $className) {
$affected = false; $affected = false;
$class = $em->getClassMetadata($className); $class = $em->getClassMetadata($className);
@ -88,27 +88,27 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
foreach ($updateItems as $updateItem) { foreach ($updateItems as $updateItem) {
$field = $updateItem->pathExpression->field; $field = $updateItem->pathExpression->field;
if (isset($class->fieldMappings[$field]) && ! isset($class->fieldMappings[$field]['inherited']) || if (isset($class->fieldMappings[$field]) && ! isset($class->fieldMappings[$field]['inherited']) ||
isset($class->associationMappings[$field]) && ! isset($class->associationMappings[$field]['inherited'])) { isset($class->associationMappings[$field]) && ! isset($class->associationMappings[$field]['inherited'])) {
$newValue = $updateItem->newValue; $newValue = $updateItem->newValue;
if ( ! $affected) { if ( ! $affected) {
$affected = true; $affected = true;
++$i; ++$i;
} else { } else {
$updateSql .= ', '; $updateSql .= ', ';
} }
$updateSql .= $sqlWalker->walkUpdateItem($updateItem); $updateSql .= $sqlWalker->walkUpdateItem($updateItem);
//FIXME: parameters can be more deeply nested. traverse the tree. //FIXME: parameters can be more deeply nested. traverse the tree.
//FIXME (URGENT): With query cache the parameter is out of date. Move to execute() stage. //FIXME (URGENT): With query cache the parameter is out of date. Move to execute() stage.
if ($newValue instanceof AST\InputParameter) { if ($newValue instanceof AST\InputParameter) {
$paramKey = $newValue->name; $paramKey = $newValue->name;
$this->_sqlParameters[$i]['parameters'][] = $sqlWalker->getQuery()->getParameter($paramKey); $this->_sqlParameters[$i]['parameters'][] = $sqlWalker->getQuery()->getParameter($paramKey);
$this->_sqlParameters[$i]['types'][] = $sqlWalker->getQuery()->getParameterType($paramKey); $this->_sqlParameters[$i]['types'][] = $sqlWalker->getQuery()->getParameterType($paramKey);
++$this->_numParametersInUpdateClause; ++$this->_numParametersInUpdateClause;
} }
} }
@ -118,12 +118,12 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
$this->_sqlStatements[$i] = $updateSql . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')'; $this->_sqlStatements[$i] = $updateSql . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')';
} }
} }
// Append WHERE clause to insertSql, if there is one. // Append WHERE clause to insertSql, if there is one.
if ($AST->whereClause) { if ($AST->whereClause) {
$this->_insertSql .= $sqlWalker->walkWhereClause($AST->whereClause); $this->_insertSql .= $sqlWalker->walkWhereClause($AST->whereClause);
} }
// 4. Store DDL for temporary identifier table. // 4. Store DDL for temporary identifier table.
$columnDefinitions = array(); $columnDefinitions = array();
@ -133,10 +133,10 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
'type' => Type::getType($rootClass->getTypeOfColumn($idColumnName)) 'type' => Type::getType($rootClass->getTypeOfColumn($idColumnName))
); );
} }
$this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
$this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable);
} }
@ -152,8 +152,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
// Insert identifiers. Parameters from the update clause are cut off. // Insert identifiers. Parameters from the update clause are cut off.
$numUpdated = $conn->executeUpdate( $numUpdated = $conn->executeUpdate(
$this->_insertSql, $this->_insertSql,
array_slice($params, $this->_numParametersInUpdateClause), array_slice($params, $this->_numParametersInUpdateClause),
array_slice($types, $this->_numParametersInUpdateClause) array_slice($types, $this->_numParametersInUpdateClause)
); );
@ -161,12 +161,12 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
for ($i=0, $count=count($this->_sqlStatements); $i<$count; ++$i) { for ($i=0, $count=count($this->_sqlStatements); $i<$count; ++$i) {
$parameters = array(); $parameters = array();
$types = array(); $types = array();
if (isset($this->_sqlParameters[$i])) { if (isset($this->_sqlParameters[$i])) {
$parameters = isset($this->_sqlParameters[$i]['parameters']) ? $this->_sqlParameters[$i]['parameters'] : array(); $parameters = isset($this->_sqlParameters[$i]['parameters']) ? $this->_sqlParameters[$i]['parameters'] : array();
$types = isset($this->_sqlParameters[$i]['types']) ? $this->_sqlParameters[$i]['types'] : array(); $types = isset($this->_sqlParameters[$i]['types']) ? $this->_sqlParameters[$i]['types'] : array();
} }
$conn->executeUpdate($this->_sqlStatements[$i], $parameters, $types); $conn->executeUpdate($this->_sqlStatements[$i], $parameters, $types);
} }

View File

@ -30,7 +30,7 @@ use Doctrine\DBAL\Connection,
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @todo This is exactly the same as SingleSelectExecutor. Unify in SingleStatementExecutor. * @todo This is exactly the same as SingleSelectExecutor. Unify in SingleStatementExecutor.
*/ */
class SingleTableDeleteUpdateExecutor extends AbstractSqlExecutor class SingleTableDeleteUpdateExecutor extends AbstractSqlExecutor
{ {

View File

@ -40,7 +40,7 @@ class Comparison
const LTE = '<='; const LTE = '<=';
const GT = '>'; const GT = '>';
const GTE = '>='; const GTE = '>=';
private $_leftExpr; private $_leftExpr;
private $_operator; private $_operator;
private $_rightExpr; private $_rightExpr;

View File

@ -38,17 +38,17 @@ class From
* @var string * @var string
*/ */
private $_from; private $_from;
/** /**
* @var string * @var string
*/ */
private $_alias; private $_alias;
/** /**
* @var string * @var string
*/ */
private $_indexBy; private $_indexBy;
/** /**
* @param string $from The class name. * @param string $from The class name.
* @param string $alias The alias of the class. * @param string $alias The alias of the class.
@ -60,7 +60,7 @@ class From
$this->_alias = $alias; $this->_alias = $alias;
$this->_indexBy = $indexBy; $this->_indexBy = $indexBy;
} }
/** /**
* @return string * @return string
*/ */
@ -82,7 +82,7 @@ class From
*/ */
public function __toString() public function __toString()
{ {
return $this->_from . ' ' . $this->_alias . return $this->_from . ' ' . $this->_alias .
($this->_indexBy ? ' INDEX BY ' . $this->_indexBy : ''); ($this->_indexBy ? ' INDEX BY ' . $this->_indexBy : '');
} }
} }

View File

@ -36,10 +36,10 @@ class Join
{ {
const INNER_JOIN = 'INNER'; const INNER_JOIN = 'INNER';
const LEFT_JOIN = 'LEFT'; const LEFT_JOIN = 'LEFT';
const ON = 'ON'; const ON = 'ON';
const WITH = 'WITH'; const WITH = 'WITH';
private $_joinType; private $_joinType;
private $_join; private $_join;
private $_alias; private $_alias;

View File

@ -49,18 +49,18 @@ class Math
{ {
// Adjusting Left Expression // Adjusting Left Expression
$leftExpr = (string) $this->_leftExpr; $leftExpr = (string) $this->_leftExpr;
if ($this->_leftExpr instanceof Math) { if ($this->_leftExpr instanceof Math) {
$leftExpr = '(' . $leftExpr . ')'; $leftExpr = '(' . $leftExpr . ')';
} }
// Adjusting Right Expression // Adjusting Right Expression
$rightExpr = (string) $this->_rightExpr; $rightExpr = (string) $this->_rightExpr;
if ($this->_rightExpr instanceof Math) { if ($this->_rightExpr instanceof Math) {
$rightExpr = '(' . $rightExpr . ')'; $rightExpr = '(' . $rightExpr . ')';
} }
return $leftExpr . ' ' . $this->_operator . ' ' . $rightExpr; return $leftExpr . ' ' . $this->_operator . ' ' . $rightExpr;
} }
} }

View File

@ -39,9 +39,9 @@ class ParameterTypeInferer
* Infer type of a given value, returning a compatible constant: * Infer type of a given value, returning a compatible constant:
* - Type (\Doctrine\DBAL\Types\Type::*) * - Type (\Doctrine\DBAL\Types\Type::*)
* - Connection (\Doctrine\DBAL\Connection::PARAM_*) * - Connection (\Doctrine\DBAL\Connection::PARAM_*)
* *
* @param mixed $value Parameter value * @param mixed $value Parameter value
* *
* @return mixed Parameter type constant * @return mixed Parameter type constant
*/ */
public static function inferType($value) public static function inferType($value)

View File

@ -37,14 +37,14 @@ class ParserResult
{ {
/** /**
* The SQL executor used for executing the SQL. * The SQL executor used for executing the SQL.
* *
* @var \Doctrine\ORM\Query\Exec\AbstractSqlExecutor * @var \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
*/ */
private $_sqlExecutor; private $_sqlExecutor;
/** /**
* The ResultSetMapping that describes how to map the SQL result set. * The ResultSetMapping that describes how to map the SQL result set.
* *
* @var \Doctrine\ORM\Query\ResultSetMapping * @var \Doctrine\ORM\Query\ResultSetMapping
*/ */
private $_resultSetMapping; private $_resultSetMapping;
@ -55,7 +55,7 @@ class ParserResult
* @var array * @var array
*/ */
private $_parameterMappings = array(); private $_parameterMappings = array();
/** /**
* Initializes a new instance of the <tt>ParserResult</tt> class. * Initializes a new instance of the <tt>ParserResult</tt> class.
* The new instance is initialized with an empty <tt>ResultSetMapping</tt>. * The new instance is initialized with an empty <tt>ResultSetMapping</tt>.
@ -67,7 +67,7 @@ class ParserResult
/** /**
* Gets the ResultSetMapping for the parsed query. * Gets the ResultSetMapping for the parsed query.
* *
* @return ResultSetMapping The result set mapping of the parsed query or NULL * @return ResultSetMapping The result set mapping of the parsed query or NULL
* if the query is not a SELECT query. * if the query is not a SELECT query.
*/ */
@ -88,7 +88,7 @@ class ParserResult
/** /**
* Sets the SQL executor that should be used for this ParserResult. * Sets the SQL executor that should be used for this ParserResult.
* *
* @param \Doctrine\ORM\Query\Exec\AbstractSqlExecutor $executor * @param \Doctrine\ORM\Query\Exec\AbstractSqlExecutor $executor
*/ */
public function setSqlExecutor($executor) public function setSqlExecutor($executor)
@ -98,14 +98,14 @@ class ParserResult
/** /**
* Gets the SQL executor used by this ParserResult. * Gets the SQL executor used by this ParserResult.
* *
* @return \Doctrine\ORM\Query\Exec\AbstractSqlExecutor * @return \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
*/ */
public function getSqlExecutor() public function getSqlExecutor()
{ {
return $this->_sqlExecutor; return $this->_sqlExecutor;
} }
/** /**
* Adds a DQL to SQL parameter mapping. One DQL parameter name/position can map to * Adds a DQL to SQL parameter mapping. One DQL parameter name/position can map to
* several SQL parameter positions. * several SQL parameter positions.
@ -117,17 +117,17 @@ class ParserResult
{ {
$this->_parameterMappings[$dqlPosition][] = $sqlPosition; $this->_parameterMappings[$dqlPosition][] = $sqlPosition;
} }
/** /**
* Gets all DQL to SQL parameter mappings. * Gets all DQL to SQL parameter mappings.
* *
* @return array The parameter mappings. * @return array The parameter mappings.
*/ */
public function getParameterMappings() public function getParameterMappings()
{ {
return $this->_parameterMappings; return $this->_parameterMappings;
} }
/** /**
* Gets the SQL parameter positions for a DQL parameter name/position. * Gets the SQL parameter positions for a DQL parameter name/position.
* *

View File

@ -131,7 +131,7 @@ class ResultSetMapping
if ($resultAlias !== null) { if ($resultAlias !== null) {
$this->isMixed = true; $this->isMixed = true;
} }
return $this; return $this;
} }
@ -150,7 +150,7 @@ class ResultSetMapping
{ {
$this->discriminatorColumns[$alias] = $discrColumn; $this->discriminatorColumns[$alias] = $discrColumn;
$this->columnOwnerMap[$discrColumn] = $alias; $this->columnOwnerMap[$discrColumn] = $alias;
return $this; return $this;
} }
@ -185,7 +185,7 @@ class ResultSetMapping
throw new \LogicException($message); throw new \LogicException($message);
} }
*/ */
return $this; return $this;
} }
@ -198,7 +198,7 @@ class ResultSetMapping
public function addIndexByScalar($resultColumnName) public function addIndexByScalar($resultColumnName)
{ {
$this->indexByMap['scalars'] = $resultColumnName; $this->indexByMap['scalars'] = $resultColumnName;
return $this; return $this;
} }
@ -212,7 +212,7 @@ class ResultSetMapping
public function addIndexByColumn($alias, $resultColumnName) public function addIndexByColumn($alias, $resultColumnName)
{ {
$this->indexByMap[$alias] = $resultColumnName; $this->indexByMap[$alias] = $resultColumnName;
return $this; return $this;
} }
@ -268,7 +268,7 @@ class ResultSetMapping
if ( ! $this->isMixed && $this->scalarMappings) { if ( ! $this->isMixed && $this->scalarMappings) {
$this->isMixed = true; $this->isMixed = true;
} }
return $this; return $this;
} }
@ -287,7 +287,7 @@ class ResultSetMapping
$this->aliasMap[$alias] = $class; $this->aliasMap[$alias] = $class;
$this->parentAliasMap[$alias] = $parentAlias; $this->parentAliasMap[$alias] = $parentAlias;
$this->relationMap[$alias] = $relation; $this->relationMap[$alias] = $relation;
return $this; return $this;
} }
@ -306,7 +306,7 @@ class ResultSetMapping
if ( ! $this->isMixed && $this->fieldMappings) { if ( ! $this->isMixed && $this->fieldMappings) {
$this->isMixed = true; $this->isMixed = true;
} }
return $this; return $this;
} }
@ -469,7 +469,7 @@ class ResultSetMapping
if ($isIdentifierColumn) { if ($isIdentifierColumn) {
$this->isIdentifierColumn[$alias][$columnName] = true; $this->isIdentifierColumn[$alias][$columnName] = true;
} }
return $this; return $this;
} }
} }

View File

@ -51,11 +51,11 @@ class MetadataCommand extends Console\Command\Command
'If defined, cache entries will be flushed instead of deleted/invalidated.' 'If defined, cache entries will be flushed instead of deleted/invalidated.'
) )
)); ));
$fullName = $this->getName(); $fullName = $this->getName();
$this->setHelp(<<<EOT $this->setHelp(<<<EOT
The <info>$fullName</info> command is meant to clear the metadata cache of associated Entity Manager. The <info>$fullName</info> command is meant to clear the metadata cache of associated Entity Manager.
It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider
instance completely. instance completely.
The execution type differ on how you execute the command. The execution type differ on how you execute the command.
@ -66,7 +66,7 @@ If you want to invalidate the entries (and not delete from cache instance), this
Alternatively, if you want to flush the cache provider using this command: Alternatively, if you want to flush the cache provider using this command:
<info>$fullName --flush</info> <info>$fullName --flush</info>
Finally, be aware that if <info>--flush</info> option is passed, not all cache providers are able to flush entries, Finally, be aware that if <info>--flush</info> option is passed, not all cache providers are able to flush entries,
because of a limitation of its execution nature. because of a limitation of its execution nature.
EOT EOT
@ -84,7 +84,7 @@ EOT
if ( ! $cacheDriver) { if ( ! $cacheDriver) {
throw new \InvalidArgumentException('No Metadata cache driver is configured on given EntityManager.'); throw new \InvalidArgumentException('No Metadata cache driver is configured on given EntityManager.');
} }
if ($cacheDriver instanceof Cache\ApcCache) { if ($cacheDriver instanceof Cache\ApcCache) {
throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI.");
} }
@ -93,12 +93,12 @@ EOT
$result = $cacheDriver->deleteAll(); $result = $cacheDriver->deleteAll();
$message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.'; $message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.';
if (true === $input->getOption('flush')) { if (true === $input->getOption('flush')) {
$result = $cacheDriver->flushAll(); $result = $cacheDriver->flushAll();
$message = ($result) ? 'Successfully flushed cache entries.' : $message; $message = ($result) ? 'Successfully flushed cache entries.' : $message;
} }
$output->write($message . PHP_EOL); $output->write($message . PHP_EOL);
} }
} }

View File

@ -51,11 +51,11 @@ class QueryCommand extends Console\Command\Command
'If defined, cache entries will be flushed instead of deleted/invalidated.' 'If defined, cache entries will be flushed instead of deleted/invalidated.'
) )
)); ));
$fullName = $this->getName(); $fullName = $this->getName();
$this->setHelp(<<<EOT $this->setHelp(<<<EOT
The <info>$fullName</info> command is meant to clear the query cache of associated Entity Manager. The <info>$fullName</info> command is meant to clear the query cache of associated Entity Manager.
It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider
instance completely. instance completely.
The execution type differ on how you execute the command. The execution type differ on how you execute the command.
@ -66,7 +66,7 @@ If you want to invalidate the entries (and not delete from cache instance), this
Alternatively, if you want to flush the cache provider using this command: Alternatively, if you want to flush the cache provider using this command:
<info>$fullName --flush</info> <info>$fullName --flush</info>
Finally, be aware that if <info>--flush</info> option is passed, not all cache providers are able to flush entries, Finally, be aware that if <info>--flush</info> option is passed, not all cache providers are able to flush entries,
because of a limitation of its execution nature. because of a limitation of its execution nature.
EOT EOT
@ -84,7 +84,7 @@ EOT
if ( ! $cacheDriver) { if ( ! $cacheDriver) {
throw new \InvalidArgumentException('No Query cache driver is configured on given EntityManager.'); throw new \InvalidArgumentException('No Query cache driver is configured on given EntityManager.');
} }
if ($cacheDriver instanceof Cache\ApcCache) { if ($cacheDriver instanceof Cache\ApcCache) {
throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI.");
} }
@ -93,12 +93,12 @@ EOT
$result = $cacheDriver->deleteAll(); $result = $cacheDriver->deleteAll();
$message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.'; $message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.';
if (true === $input->getOption('flush')) { if (true === $input->getOption('flush')) {
$result = $cacheDriver->flushAll(); $result = $cacheDriver->flushAll();
$message = ($result) ? 'Successfully flushed cache entries.' : $message; $message = ($result) ? 'Successfully flushed cache entries.' : $message;
} }
$output->write($message . PHP_EOL); $output->write($message . PHP_EOL);
} }
} }

View File

@ -51,11 +51,11 @@ class ResultCommand extends Console\Command\Command
'If defined, cache entries will be flushed instead of deleted/invalidated.' 'If defined, cache entries will be flushed instead of deleted/invalidated.'
) )
)); ));
$fullName = $this->getName(); $fullName = $this->getName();
$this->setHelp(<<<EOT $this->setHelp(<<<EOT
The <info>$fullName</info> command is meant to clear the result cache of associated Entity Manager. The <info>$fullName</info> command is meant to clear the result cache of associated Entity Manager.
It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider It is possible to invalidate all cache entries at once - called delete -, or flushes the cache provider
instance completely. instance completely.
The execution type differ on how you execute the command. The execution type differ on how you execute the command.
@ -66,7 +66,7 @@ If you want to invalidate the entries (and not delete from cache instance), this
Alternatively, if you want to flush the cache provider using this command: Alternatively, if you want to flush the cache provider using this command:
<info>$fullName --flush</info> <info>$fullName --flush</info>
Finally, be aware that if <info>--flush</info> option is passed, not all cache providers are able to flush entries, Finally, be aware that if <info>--flush</info> option is passed, not all cache providers are able to flush entries,
because of a limitation of its execution nature. because of a limitation of its execution nature.
EOT EOT
@ -84,7 +84,7 @@ EOT
if ( ! $cacheDriver) { if ( ! $cacheDriver) {
throw new \InvalidArgumentException('No Result cache driver is configured on given EntityManager.'); throw new \InvalidArgumentException('No Result cache driver is configured on given EntityManager.');
} }
if ($cacheDriver instanceof Cache\ApcCache) { if ($cacheDriver instanceof Cache\ApcCache) {
throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI."); throw new \LogicException("Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI.");
} }
@ -93,12 +93,12 @@ EOT
$result = $cacheDriver->deleteAll(); $result = $cacheDriver->deleteAll();
$message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.'; $message = ($result) ? 'Successfully deleted cache entries.' : 'No cache entries were deleted.';
if (true === $input->getOption('flush')) { if (true === $input->getOption('flush')) {
$result = $cacheDriver->flushAll(); $result = $cacheDriver->flushAll();
$message = ($result) ? 'Successfully flushed cache entries.' : $message; $message = ($result) ? 'Successfully flushed cache entries.' : $message;
} }
$output->write($message . PHP_EOL); $output->write($message . PHP_EOL);
} }
} }

View File

@ -80,7 +80,7 @@ class ConvertDoctrine1SchemaCommand extends Console\Command\Command
if ($this->metadataExporter == null) { if ($this->metadataExporter == null) {
$this->metadataExporter = new ClassMetadataExporter(); $this->metadataExporter = new ClassMetadataExporter();
} }
return $this->metadataExporter; return $this->metadataExporter;
} }
@ -91,7 +91,7 @@ class ConvertDoctrine1SchemaCommand extends Console\Command\Command
{ {
$this->metadataExporter = $metadataExporter; $this->metadataExporter = $metadataExporter;
} }
/** /**
* @see Console\Command\Command * @see Console\Command\Command
*/ */

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