Skip to content

Commit 79dbb42

Browse files
author
Oliver Tischlinger
committed
fix issue 1556: Replace EntityManager with EntityManagerInterface in method declarations, etc.
1 parent ad2d4f4 commit 79dbb42

File tree

13 files changed

+39
-39
lines changed

13 files changed

+39
-39
lines changed

lib/Gedmo/Mapping/Event/Adapter/ORM.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Gedmo\Mapping\Event\Adapter;
44

5+
use Doctrine\ORM\EntityManagerInterface;
56
use Gedmo\Mapping\Event\AdapterInterface;
67
use Gedmo\Exception\RuntimeException;
78
use Doctrine\Common\EventArgs;
8-
use Doctrine\ORM\EntityManager;
99
use Doctrine\ORM\Event\LifecycleEventArgs;
1010

1111
/**
@@ -23,7 +23,7 @@ class ORM implements AdapterInterface
2323
private $args;
2424

2525
/**
26-
* @var \Doctrine\ORM\EntityManager
26+
* @var \Doctrine\ORM\EntityManagerInterface
2727
*/
2828
private $em;
2929

@@ -75,9 +75,9 @@ public function __call($method, $args)
7575
/**
7676
* Set the entity manager
7777
*
78-
* @param \Doctrine\ORM\EntityManager $em
78+
* @param \Doctrine\ORM\EntityManagerInterface $em
7979
*/
80-
public function setEntityManager(EntityManager $em)
80+
public function setEntityManager(EntityManagerInterface $em)
8181
{
8282
$this->em = $em;
8383
}

lib/Gedmo/References/Mapping/Event/Adapter/ODM.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Doctrine\ODM\MongoDB\DocumentManager;
66
use Doctrine\ODM\MongoDB\Proxy\Proxy as MongoDBProxy;
7-
use Doctrine\ORM\EntityManager;
7+
use Doctrine\ORM\EntityManagerInterface;
88
use Doctrine\ORM\Proxy\Proxy as ORMProxy;
99
use Gedmo\Mapping\Event\Adapter\ODM as BaseAdapterODM;
1010
use Gedmo\References\Mapping\Event\ReferencesAdapter;
@@ -28,7 +28,7 @@ public function getIdentifier($om, $object, $single = true)
2828
return $this->extractIdentifier($om, $object, $single);
2929
}
3030

31-
if ($om instanceof EntityManager) {
31+
if ($om instanceof EntityManagerInterface) {
3232
if ($object instanceof ORMProxy) {
3333
$id = $om->getUnitOfWork()->getEntityIdentifier($object);
3434
} else {
@@ -88,7 +88,7 @@ public function extractIdentifier($om, $object, $single = true)
8888
/**
8989
* Override so we don't get an exception. We want to allow this.
9090
*/
91-
private function throwIfNotEntityManager(EntityManager $em)
91+
private function throwIfNotEntityManager(EntityManagerInterface $em)
9292
{
9393
}
9494
}

lib/Gedmo/References/Mapping/Event/Adapter/ORM.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Doctrine\ODM\MongoDB\DocumentManager as MongoDocumentManager;
66
use Doctrine\ODM\MongoDB\Proxy\Proxy as MongoDBProxy;
77
use Doctrine\ODM\PHPCR\DocumentManager as PhpcrDocumentManager;
8-
use Doctrine\ORM\EntityManager;
8+
use Doctrine\ORM\EntityManagerInterface;
99
use Doctrine\ORM\Proxy\Proxy as ORMProxy;
1010
use Gedmo\Exception\InvalidArgumentException;
1111
use Gedmo\Mapping\Event\Adapter\ORM as BaseAdapterORM;
@@ -26,7 +26,7 @@ final class ORM extends BaseAdapterORM implements ReferencesAdapter
2626
*/
2727
public function getIdentifier($om, $object, $single = true)
2828
{
29-
if ($om instanceof EntityManager) {
29+
if ($om instanceof EntityManagerInterface) {
3030
return $this->extractIdentifier($om, $object, $single);
3131
}
3232

lib/Gedmo/Sortable/Entity/Repository/SortableRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Gedmo\Sortable\Entity\Repository;
44

5+
use Doctrine\ORM\EntityManagerInterface;
56
use Doctrine\ORM\EntityRepository;
6-
use Doctrine\ORM\EntityManager;
77
use Doctrine\ORM\Mapping\ClassMetadata;
88
use Gedmo\Sortable\SortableListener;
99

@@ -25,7 +25,7 @@ class SortableRepository extends EntityRepository
2525
protected $config = null;
2626
protected $meta = null;
2727

28-
public function __construct(EntityManager $em, ClassMetadata $class)
28+
public function __construct(EntityManagerInterface $em, ClassMetadata $class)
2929
{
3030
parent::__construct($em, $class);
3131
$sortableListener = null;

lib/Gedmo/Tool/Wrapper/AbstractWrapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Gedmo\Tool\Wrapper;
44

5-
use Doctrine\ORM\EntityManager;
65
use Doctrine\ODM\MongoDB\DocumentManager;
76
use Doctrine\Common\Persistence\ObjectManager;
7+
use Doctrine\ORM\EntityManagerInterface;
88
use Gedmo\Tool\WrapperInterface;
99
use Gedmo\Exception\UnsupportedObjectManagerException;
1010

@@ -57,7 +57,7 @@ abstract class AbstractWrapper implements WrapperInterface
5757
*/
5858
public static function wrap($object, ObjectManager $om)
5959
{
60-
if ($om instanceof EntityManager) {
60+
if ($om instanceof EntityManagerInterface) {
6161
return new EntityWrapper($object, $om);
6262
} elseif ($om instanceof DocumentManager) {
6363
return new MongoDocumentWrapper($object, $om);

lib/Gedmo/Tool/Wrapper/EntityWrapper.php

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

33
namespace Gedmo\Tool\Wrapper;
44

5-
use Doctrine\ORM\EntityManager;
5+
use Doctrine\ORM\EntityManagerInterface;
66
use Doctrine\ORM\Proxy\Proxy;
77

88
/**
@@ -32,9 +32,9 @@ class EntityWrapper extends AbstractWrapper
3232
* Wrap entity
3333
*
3434
* @param object $entity
35-
* @param \Doctrine\ORM\EntityManager $em
35+
* @param \Doctrine\ORM\EntityManagerInterface $em
3636
*/
37-
public function __construct($entity, EntityManager $em)
37+
public function __construct($entity, EntityManagerInterface $em)
3838
{
3939
$this->om = $em;
4040
$this->object = $entity;

lib/Gedmo/Translatable/Entity/Repository/TranslationRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Gedmo\Translatable\Entity\Repository;
44

5+
use Doctrine\ORM\EntityManagerInterface;
56
use Gedmo\Translatable\TranslatableListener;
67
use Doctrine\ORM\EntityRepository;
78
use Doctrine\ORM\Query;
8-
use Doctrine\ORM\EntityManager;
99
use Doctrine\ORM\Mapping\ClassMetadata;
1010
use Gedmo\Tool\Wrapper\EntityWrapper;
1111
use Gedmo\Translatable\Mapping\Event\Adapter\ORM as TranslatableAdapterORM;
@@ -31,7 +31,7 @@ class TranslationRepository extends EntityRepository
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function __construct(EntityManager $em, ClassMetadata $class)
34+
public function __construct(EntityManagerInterface $em, ClassMetadata $class)
3535
{
3636
if ($class->getReflectionClass()->isSubclassOf('Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation')) {
3737
throw new \Gedmo\Exception\UnexpectedValueException('This repository is useless for personal translations');

lib/Gedmo/Tree/Entity/Repository/AbstractTreeRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Gedmo\Tree\Entity\Repository;
44

5+
use Doctrine\ORM\EntityManagerInterface;
56
use Doctrine\ORM\EntityRepository;
6-
use Doctrine\ORM\EntityManager;
77
use Doctrine\ORM\Mapping\ClassMetadata;
88
use Gedmo\Tool\Wrapper\EntityWrapper;
99
use Gedmo\Tree\RepositoryUtils;
@@ -29,7 +29,7 @@ abstract class AbstractTreeRepository extends EntityRepository implements Reposi
2929
/**
3030
* {@inheritdoc}
3131
*/
32-
public function __construct(EntityManager $em, ClassMetadata $class)
32+
public function __construct(EntityManagerInterface $em, ClassMetadata $class)
3333
{
3434
parent::__construct($em, $class);
3535
$treeListener = null;

lib/Gedmo/Tree/RepositoryUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function childrenHierarchy($node = null, $direct = false, array $options
5050

5151
if ($node !== null) {
5252
if ($node instanceof $meta->name) {
53-
$wrapperClass = $this->om instanceof \Doctrine\ORM\EntityManager ?
53+
$wrapperClass = $this->om instanceof \Doctrine\ORM\EntityManagerInterface ?
5454
'\Gedmo\Tool\Wrapper\EntityWrapper' :
5555
'\Gedmo\Tool\Wrapper\MongoDocumentWrapper';
5656
$wrapped = new $wrapperClass($node, $this->om);

lib/Gedmo/Tree/Strategy/ORM/Closure.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Gedmo\Tree\Strategy\ORM;
44

55
use Doctrine\DBAL\Connection;
6+
use Doctrine\ORM\EntityManagerInterface;
67
use Doctrine\ORM\Version;
7-
use Doctrine\ORM\EntityManager;
88
use Doctrine\ORM\Mapping\ClassMetadataInfo;
99
use Doctrine\Common\Persistence\ObjectManager;
1010
use Gedmo\Tree\Strategy;
@@ -403,11 +403,11 @@ public function processScheduledUpdate($em, $node, AdapterInterface $ea)
403403
/**
404404
* Update node and closures
405405
*
406-
* @param EntityManager $em
406+
* @param EntityManagerInterface $em
407407
* @param object $node
408408
* @param object $oldParent
409409
*/
410-
public function updateNode(EntityManager $em, $node, $oldParent)
410+
public function updateNode(EntityManagerInterface $em, $node, $oldParent)
411411
{
412412
$wrapped = AbstractWrapper::wrap($node, $em);
413413
$meta = $wrapped->getMetadata();

0 commit comments

Comments
 (0)