From 455f877486df8717eb4e766789d307fa66df5a74 Mon Sep 17 00:00:00 2001 From: romanb Date: Tue, 30 Jun 2009 16:00:28 +0000 Subject: [PATCH] [2.0] Minor refactorings and docblock adjustments. Fixed #3202. --- .../ORM/Mapping/Driver/AbstractFileDriver.php | 2 +- .../ORM/Mapping/Driver/AnnotationDriver.php | 18 +++++++++--------- .../ORM/Mapping/Driver/DoctrineAnnotations.php | 1 - lib/Doctrine/ORM/Mapping/Driver/Driver.php | 2 +- lib/Doctrine/ORM/Query.php | 6 +++--- lib/Doctrine/ORM/Query/AST/UpdateItem.php | 3 ++- lib/Doctrine/ORM/Query/SqlWalker.php | 1 + lib/Doctrine/ORM/UnitOfWork.php | 4 ++-- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php index 47013d66d..573c3bdaf 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php @@ -24,7 +24,7 @@ namespace Doctrine\ORM\Mapping\Driver; use Doctrine\ORM\Mapping\MappingException; /** - * SchemaMetadata mapping driver interface + * Base driver for file-based metadata drivers. * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.com diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index c5d71638b..2cf97e06b 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -99,23 +99,23 @@ class AnnotationDriver implements Driver $mapping = array(); $mapping['fieldName'] = $property->getName(); - // Check for DoctrineJoinColummn/DoctrineJoinColumns annotations + // Check for JoinColummn/JoinColumns annotations $joinColumns = array(); if ($joinColumnAnnot = $property->getAnnotation('JoinColumn')) { $joinColumns[] = array( - 'name' => $joinColumnAnnot->name, - 'referencedColumnName' => $joinColumnAnnot->referencedColumnName, - 'unique' => $joinColumnAnnot->unique, - 'nullable' => $joinColumnAnnot->nullable, - 'onDelete' => $joinColumnAnnot->onDelete, - 'onUpdate' => $joinColumnAnnot->onUpdate + 'name' => $joinColumnAnnot->name, + 'referencedColumnName' => $joinColumnAnnot->referencedColumnName, + 'unique' => $joinColumnAnnot->unique, + 'nullable' => $joinColumnAnnot->nullable, + 'onDelete' => $joinColumnAnnot->onDelete, + 'onUpdate' => $joinColumnAnnot->onUpdate ); } else if ($joinColumnsAnnot = $property->getAnnotation('JoinColumns')) { $joinColumns = $joinColumnsAnnot->value; } - // Field can only be annotated with one of: DoctrineColumn, - // DoctrineOneToOne, DoctrineOneToMany, DoctrineManyToOne, DoctrineManyToMany + // Field can only be annotated with one of: + // @Column, @OneToOne, @OneToMany, @ManyToOne, @ManyToMany if ($columnAnnot = $property->getAnnotation('Column')) { if ($columnAnnot->type == null) { throw DoctrineException::updateMe("Missing type on property " . $property->getName()); diff --git a/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php b/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php index 519ff44ca..5b533424a 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php @@ -54,7 +54,6 @@ final class Column extends \Annotation { public $unique = false; public $nullable = false; public $name; - //public $quote = false; } final class OneToOne extends \Annotation { public $targetEntity; diff --git a/lib/Doctrine/ORM/Mapping/Driver/Driver.php b/lib/Doctrine/ORM/Mapping/Driver/Driver.php index ab9d509ae..ce0cf2388 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/Driver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/Driver.php @@ -24,7 +24,7 @@ namespace Doctrine\ORM\Mapping\Driver; use Doctrine\ORM\Mapping\ClassMetadata; /** - * SchemaMetadata mapping driver interface + * Contract for metadata drivers. * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.com diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index f0e978fbc..a993e4b1d 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -202,7 +202,7 @@ final class Query extends AbstractQuery * Defines a cache driver to be used for caching queries. * * @param Doctrine_Cache_Interface|null $driver Cache driver - * @return Doctrine_ORM_Query + * @return Query This query instance. */ public function setQueryCacheDriver($queryCache) { @@ -229,7 +229,7 @@ final class Query extends AbstractQuery * Defines how long the query cache will be active before expire. * * @param integer $timeToLive How long the cache entry is valid - * @return Doctrine_ORM_Query + * @return Query This query instance. */ public function setQueryCacheLifetime($timeToLive) { @@ -255,7 +255,7 @@ final class Query extends AbstractQuery * Defines if the query cache is active or not. * * @param boolean $expire Whether or not to force query cache expiration. - * @return Doctrine_ORM_Query + * @return Query This query instance. */ public function setExpireQueryCache($expire = true) { diff --git a/lib/Doctrine/ORM/Query/AST/UpdateItem.php b/lib/Doctrine/ORM/Query/AST/UpdateItem.php index 72fe47db9..a0e828823 100644 --- a/lib/Doctrine/ORM/Query/AST/UpdateItem.php +++ b/lib/Doctrine/ORM/Query/AST/UpdateItem.php @@ -26,7 +26,8 @@ namespace Doctrine\ORM\Query\AST; * NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary | * EnumPrimary | SimpleEntityExpression | "NULL" * - * @author robo + * @author Roman Borschel + * @since 2.0 */ class UpdateItem extends Node { diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 9f01629df..526e72d8c 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -32,6 +32,7 @@ use Doctrine\Common\DoctrineException; * @author Roman Borschel * @since 2.0 * @todo Code review for identifier quoting. + * @todo Code review for schema usage with table names. */ class SqlWalker implements TreeWalker { diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 84cce2946..4ed02e960 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1536,8 +1536,8 @@ class UnitOfWork implements PropertyChangedListener $this->_entityUpdates[$oid] = $entity; } else if ($oldValue instanceof PersistentCollection) { // A PersistentCollection was de-referenced, so delete it. - if ( ! in_array($orgValue, $this->_collectionDeletions, true)) { - $this->_collectionDeletions[] = $orgValue; + if ( ! in_array($oldValue, $this->_collectionDeletions, true)) { + $this->_collectionDeletions[] = $oldValue; } } } else {