From 918e2d201810ffbb59fd875de6ad6fdc641afc02 Mon Sep 17 00:00:00 2001 From: Guilherme Blanco Date: Tue, 13 Sep 2011 01:14:36 -0300 Subject: [PATCH] Fixed remaining Doctrine packages upgrade. --- .../Mapping/Driver/DoctrineAnnotations.php | 68 +++++++++---------- lib/Doctrine/ORM/Query.php | 4 +- .../Tests/ORM/Functional/QueryCacheTest.php | 5 +- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php b/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php index 6ff33771e..e471a0d71 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php @@ -19,7 +19,7 @@ namespace Doctrine\ORM\Mapping; -abstract class Annotation {} +interface Annotation {} /* Annotations */ @@ -28,7 +28,7 @@ abstract class Annotation {} * @Annotation * @Target("CLASS") */ -final class Entity extends Annotation { +final class Entity implements Annotation { /** @var string */ public $repositoryClass; /** @var boolean */ @@ -39,7 +39,7 @@ final class Entity extends Annotation { * @Annotation * @Target("CLASS") */ -final class MappedSuperclass extends Annotation { +final class MappedSuperclass implements Annotation { /** @var string */ public $repositoryClass; } @@ -48,7 +48,7 @@ final class MappedSuperclass extends Annotation { * @Annotation * @Target("CLASS") */ -final class InheritanceType extends Annotation { +final class InheritanceType implements Annotation { /** @var string */ public $value; } @@ -57,7 +57,7 @@ final class InheritanceType extends Annotation { * @Annotation * @Target("CLASS") */ -final class DiscriminatorColumn extends Annotation { +final class DiscriminatorColumn implements Annotation { /** @var string */ public $name; /** @var string */ @@ -72,7 +72,7 @@ final class DiscriminatorColumn extends Annotation { * @Annotation * @Target("CLASS") */ -final class DiscriminatorMap extends Annotation { +final class DiscriminatorMap implements Annotation { /** @var array */ public $value; } @@ -81,13 +81,13 @@ final class DiscriminatorMap extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class Id extends Annotation {} +final class Id implements Annotation {} /** * @Annotation * @Target("PROPERTY") */ -final class GeneratedValue extends Annotation { +final class GeneratedValue implements Annotation { /** @var string */ public $strategy = 'AUTO'; } @@ -96,13 +96,13 @@ final class GeneratedValue extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class Version extends Annotation {} +final class Version implements Annotation {} /** * @Annotation * @Target({"PROPERTY","ANNOTATION"}) */ -final class JoinColumn extends Annotation { +final class JoinColumn implements Annotation { /** @var string */ public $name; /** @var string */ @@ -123,7 +123,7 @@ final class JoinColumn extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class JoinColumns extends Annotation { +final class JoinColumns implements Annotation { /** @var array */ public $value; } @@ -132,7 +132,7 @@ final class JoinColumns extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class Column extends Annotation { +final class Column implements Annotation { /** @var string */ public $name; /** @var mixed */ @@ -157,7 +157,7 @@ final class Column extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class OneToOne extends Annotation { +final class OneToOne implements Annotation { /** @var string */ public $targetEntity; /** @var string */ @@ -176,7 +176,7 @@ final class OneToOne extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class OneToMany extends Annotation { +final class OneToMany implements Annotation { /** @var string */ public $mappedBy; /** @var string */ @@ -195,7 +195,7 @@ final class OneToMany extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class ManyToOne extends Annotation { +final class ManyToOne implements Annotation { /** @var string */ public $targetEntity; /** @var array */ @@ -210,7 +210,7 @@ final class ManyToOne extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class ManyToMany extends Annotation { +final class ManyToMany implements Annotation { /** @var string */ public $targetEntity; /** @var string */ @@ -230,7 +230,7 @@ final class ManyToMany extends Annotation { * @Target("ALL") * @todo check available targets */ -final class ElementCollection extends Annotation { +final class ElementCollection implements Annotation { /** @var string */ public $tableName; } @@ -239,7 +239,7 @@ final class ElementCollection extends Annotation { * @Annotation * @Target("CLASS") */ -final class Table extends Annotation { +final class Table implements Annotation { /** @var string */ public $name; /** @var string */ @@ -254,7 +254,7 @@ final class Table extends Annotation { * @Annotation * @Target("ANNOTATION") */ -final class UniqueConstraint extends Annotation { +final class UniqueConstraint implements Annotation { /** @var string */ public $name; /** @var array */ @@ -265,7 +265,7 @@ final class UniqueConstraint extends Annotation { * @Annotation * @Target("ANNOTATION") */ -final class Index extends Annotation { +final class Index implements Annotation { /** @var string */ public $name; /** @var array */ @@ -276,7 +276,7 @@ final class Index extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class JoinTable extends Annotation { +final class JoinTable implements Annotation { /** @var string */ public $name; /** @var string */ @@ -291,7 +291,7 @@ final class JoinTable extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class SequenceGenerator extends Annotation { +final class SequenceGenerator implements Annotation { /** @var string */ public $sequenceName; /** @var integer */ @@ -304,7 +304,7 @@ final class SequenceGenerator extends Annotation { * @Annotation * @Target("CLASS") */ -final class ChangeTrackingPolicy extends Annotation { +final class ChangeTrackingPolicy implements Annotation { /** @var string */ public $value; } @@ -313,7 +313,7 @@ final class ChangeTrackingPolicy extends Annotation { * @Annotation * @Target("PROPERTY") */ -final class OrderBy extends Annotation { +final class OrderBy implements Annotation { /** @var array */ public $value; } @@ -322,7 +322,7 @@ final class OrderBy extends Annotation { * @Annotation * @Target("CLASS") */ -final class NamedQueries extends Annotation { +final class NamedQueries implements Annotation { /** @var array */ public $value; } @@ -331,7 +331,7 @@ final class NamedQueries extends Annotation { * @Annotation * @Target("ANNOTATION") */ -final class NamedQuery extends Annotation { +final class NamedQuery implements Annotation { /** @var string */ public $name; /** @var string */ @@ -344,46 +344,46 @@ final class NamedQuery extends Annotation { * @Annotation * @Target("CLASS") */ -final class HasLifecycleCallbacks extends Annotation {} +final class HasLifecycleCallbacks implements Annotation {} /** * @Annotation * @Target("METHOD") */ -final class PrePersist extends Annotation {} +final class PrePersist implements Annotation {} /** * @Annotation * @Target("METHOD") */ -final class PostPersist extends Annotation {} +final class PostPersist implements Annotation {} /** * @Annotation * @Target("METHOD") */ -final class PreUpdate extends Annotation {} +final class PreUpdate implements Annotation {} /** * @Annotation * @Target("METHOD") */ -final class PostUpdate extends Annotation {} +final class PostUpdate implements Annotation {} /** * @Annotation * @Target("METHOD") */ -final class PreRemove extends Annotation {} +final class PreRemove implements Annotation {} /** * @Annotation * @Target("METHOD") */ -final class PostRemove extends Annotation {} +final class PostRemove implements Annotation {} /** * @Annotation * @Target("METHOD") */ -final class PostLoad extends Annotation {} +final class PostLoad implements Annotation {} diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index 9d5ad8cb3..e0bbcec5a 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -204,8 +204,9 @@ final class Query extends AbstractQuery // Check query cache. if ($this->_useQueryCache && ($queryCache = $this->getQueryCacheDriver())) { - $hash = $this->_getQueryCacheId(); + $hash = $this->_getQueryCacheId(); $cached = $this->_expireQueryCache ? false : $queryCache->fetch($hash); + if ($cached === false) { // Cache miss. $parser = new Parser($this); @@ -219,6 +220,7 @@ final class Query extends AbstractQuery $parser = new Parser($this); $this->_parserResult = $parser->parse(); } + $this->_state = self::STATE_CLEAN; return $this->_parserResult; diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php index c6c550429..eb7d662d6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php @@ -100,14 +100,11 @@ class QueryCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase public function testQueryCache_NoHitSaveParserResult() { - $this->markTestSkipped("Needs to be migrated to common 2.2"); - $this->_em->getConfiguration()->setQueryCacheImpl(new ArrayCache()); $query = $this->_em->createQuery('select ux from Doctrine\Tests\Models\CMS\CmsUser ux'); - $cache = $this->getMock('Doctrine\Common\Cache\CacheProvider', - array('doFetch', 'doContains', 'doSave', 'doDelete', 'doFlush')); + $cache = $this->getMock('Doctrine\Common\Cache\ArrayCache', array('doFetch', 'doSave')); $cache->expects($this->at(0)) ->method('doFetch') ->with($this->isType('string'))