Skip to content

Commit daa263a

Browse files
mbabkerfranmomu
authored andcommitted
Use the Persistence Proxy interface for checking ORM proxy objects
1 parent 5d0b93d commit daa263a

File tree

8 files changed

+9
-11
lines changed

8 files changed

+9
-11
lines changed

src/References/Mapping/Event/Adapter/ODM.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use Doctrine\ODM\MongoDB\DocumentManager;
1313
use Doctrine\ORM\EntityManagerInterface;
14-
use Doctrine\ORM\Proxy\Proxy as ORMProxy;
14+
use Doctrine\Persistence\Proxy as PersistenceProxy;
1515
use Gedmo\Mapping\Event\Adapter\ODM as BaseAdapterODM;
1616
use Gedmo\References\Mapping\Event\ReferencesAdapter;
1717
use ProxyManager\Proxy\GhostObjectInterface;
@@ -32,7 +32,7 @@ public function getIdentifier($om, $object, $single = true)
3232
}
3333

3434
if ($om instanceof EntityManagerInterface) {
35-
if ($object instanceof ORMProxy) {
35+
if ($object instanceof PersistenceProxy) {
3636
$id = $om->getUnitOfWork()->getEntityIdentifier($object);
3737
} else {
3838
$meta = $om->getClassMetadata(get_class($object));

src/References/Mapping/Event/Adapter/ORM.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Doctrine\ODM\MongoDB\DocumentManager as MongoDocumentManager;
1313
use Doctrine\ODM\PHPCR\DocumentManager as PhpcrDocumentManager;
1414
use Doctrine\ORM\EntityManagerInterface;
15-
use Doctrine\ORM\Proxy\Proxy as ORMProxy;
15+
use Doctrine\Persistence\Proxy as PersistenceProxy;
1616
use Gedmo\Exception\InvalidArgumentException;
1717
use Gedmo\Mapping\Event\Adapter\ORM as BaseAdapterORM;
1818
use Gedmo\References\Mapping\Event\ReferencesAdapter;
@@ -79,7 +79,7 @@ public function getSingleReference($om, $class, $identifier)
7979

8080
public function extractIdentifier($om, $object, $single = true)
8181
{
82-
if ($object instanceof ORMProxy) {
82+
if ($object instanceof PersistenceProxy) {
8383
$id = $om->getUnitOfWork()->getEntityIdentifier($object);
8484
} else {
8585
$meta = $om->getClassMetadata(get_class($object));

src/Tool/Wrapper/EntityWrapper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Doctrine\Common\Util\ClassUtils;
1313
use Doctrine\ORM\EntityManagerInterface;
1414
use Doctrine\ORM\Mapping\ClassMetadata;
15-
use Doctrine\ORM\Proxy\Proxy;
1615
use Doctrine\Persistence\Proxy as PersistenceProxy;
1716

1817
/**

src/Tree/Entity/Repository/NestedTreeRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
namespace Gedmo\Tree\Entity\Repository;
1111

1212
use Doctrine\ORM\Exception\ORMException;
13-
use Doctrine\ORM\Proxy\Proxy;
1413
use Doctrine\ORM\Query;
1514
use Doctrine\ORM\QueryBuilder;
15+
use Doctrine\Persistence\Proxy;
1616
use Gedmo\Exception\InvalidArgumentException;
1717
use Gedmo\Exception\RuntimeException;
1818
use Gedmo\Exception\UnexpectedValueException;

src/Tree/Strategy/ORM/Nested.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Doctrine\Common\Collections\Criteria;
1313
use Doctrine\ORM\EntityManagerInterface;
1414
use Doctrine\ORM\Mapping\ClassMetadata;
15-
use Doctrine\ORM\Proxy\Proxy;
15+
use Doctrine\Persistence\Proxy;
1616
use Gedmo\Exception\InvalidArgumentException;
1717
use Gedmo\Exception\UnexpectedValueException;
1818
use Gedmo\Mapping\Event\AdapterInterface;

tests/Gedmo/Timestampable/TimestampableTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
namespace Gedmo\Tests\Timestampable;
1313

1414
use Doctrine\Common\EventManager;
15-
use Doctrine\ORM\Proxy\Proxy;
16-
use Gedmo\Tests\Mapping\Fixture\Xml\Timestampable;
15+
use Doctrine\Persistence\Proxy;
1716
use Gedmo\Tests\Timestampable\Fixture\Article;
1817
use Gedmo\Tests\Timestampable\Fixture\Author;
1918
use Gedmo\Tests\Timestampable\Fixture\Comment;

tests/Gedmo/Translatable/Issue/Issue84Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Gedmo\Tests\Translatable\Issue;
1313

1414
use Doctrine\Common\EventManager;
15-
use Doctrine\ORM\Proxy\Proxy;
15+
use Doctrine\Persistence\Proxy;
1616
use Gedmo\Tests\Tool\BaseTestCaseORM;
1717
use Gedmo\Tests\Translatable\Fixture\Article;
1818
use Gedmo\Translatable\Entity\Translation;

tests/Gedmo/Wrapper/EntityWrapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Gedmo\Tests\Wrapper;
1313

1414
use Doctrine\Common\EventManager;
15-
use Doctrine\ORM\Proxy\Proxy;
15+
use Doctrine\Persistence\Proxy;
1616
use Gedmo\Tests\Tool\BaseTestCaseORM;
1717
use Gedmo\Tests\Wrapper\Fixture\Entity\Article;
1818
use Gedmo\Tests\Wrapper\Fixture\Entity\Composite;

0 commit comments

Comments
 (0)