Skip to content

Commit

Permalink
Use doctrine/bundle 2 (#1099)
Browse files Browse the repository at this point in the history
* use doctrine/bundle 2

* use doctrine/bundle 2

* Blacklist symfony/dependency-injection 4.4

* Symfony 3.4 compatibility

* Fixed usage of RegistryInterface in tests

* Add doctrine/persistence dependency

* version constraint on doctrine/doctrine-bundle matching doctrine/persistence

* version constraint of doctrine/doctrine-bundle

Co-Authored-By: Javier Spagnoletti <[email protected]>

Co-authored-by: Javier Spagnoletti <[email protected]>
  • Loading branch information
2 people authored and core23 committed Jan 9, 2020
1 parent ae889eb commit b76361f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"require": {
"php": "^7.1",
"cocur/slugify": "^1.0 || ^2.0 || ^3.0",
"doctrine/doctrine-bundle": "^1.0",
"doctrine/doctrine-bundle": "^1.12.3 || ^2.0",
"doctrine/persistence": "^1.3.3",
"sonata-project/admin-bundle": "^3.35",
"sonata-project/block-bundle": "^3.18",
"sonata-project/cache": "^1.0.2 || ^2.0",
Expand Down
8 changes: 4 additions & 4 deletions src/Entity/BlockInteractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
namespace Sonata\PageBundle\Entity;

use Doctrine\ORM\EntityManager;
use Doctrine\Persistence\ManagerRegistry;
use Sonata\BlockBundle\Model\BlockManagerInterface;
use Sonata\PageBundle\Model\BlockInteractorInterface;
use Sonata\PageBundle\Model\PageInterface;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
* This class interacts with blocks.
Expand All @@ -32,7 +32,7 @@ class BlockInteractor implements BlockInteractorInterface
protected $pageBlocksLoaded = [];

/**
* @var RegistryInterface
* @var ManagerRegistry
*/
protected $registry;

Expand All @@ -42,10 +42,10 @@ class BlockInteractor implements BlockInteractorInterface
protected $blockManager;

/**
* @param RegistryInterface $registry Doctrine registry
* @param ManagerRegistry $registry Doctrine registry
* @param BlockManagerInterface $blockManager Block manager
*/
public function __construct(RegistryInterface $registry, BlockManagerInterface $blockManager)
public function __construct(ManagerRegistry $registry, BlockManagerInterface $blockManager)
{
$this->blockManager = $blockManager;
$this->registry = $registry;
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/Transformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Sonata\BlockBundle\Model\BlockInterface;
use Sonata\BlockBundle\Model\BlockManagerInterface;
use Sonata\PageBundle\Model\PageInterface;
Expand All @@ -23,7 +24,6 @@
use Sonata\PageBundle\Model\SnapshotManagerInterface;
use Sonata\PageBundle\Model\SnapshotPageProxy;
use Sonata\PageBundle\Model\TransformerInterface;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
* This class transform a SnapshotInterface into PageInterface.
Expand Down Expand Up @@ -51,11 +51,11 @@ class Transformer implements TransformerInterface
protected $children = [];

/**
* @var RegistryInterface
* @var ManagerRegistry
*/
protected $registry;

public function __construct(SnapshotManagerInterface $snapshotManager, PageManagerInterface $pageManager, BlockManagerInterface $blockManager, RegistryInterface $registry)
public function __construct(SnapshotManagerInterface $snapshotManager, PageManagerInterface $pageManager, BlockManagerInterface $blockManager, ManagerRegistry $registry)
{
$this->snapshotManager = $snapshotManager;
$this->pageManager = $pageManager;
Expand Down
4 changes: 2 additions & 2 deletions tests/Model/BlockInteractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

namespace Sonata\PageBundle\Tests\Model;

use Doctrine\Common\Persistence\ManagerRegistry;
use PHPUnit\Framework\TestCase;
use Sonata\BlockBundle\Model\Block;
use Sonata\BlockBundle\Model\BlockInterface;
use Sonata\BlockBundle\Model\BlockManagerInterface;
use Sonata\PageBundle\Entity\BlockInteractor;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
* @author Vincent Composieux <[email protected]>
Expand All @@ -30,7 +30,7 @@ class BlockInteractorTest extends TestCase
*/
public function testCreateNewContainer()
{
$registry = $this->createMock(RegistryInterface::class);
$registry = $this->createMock(ManagerRegistry::class);

$blockManager = $this->createMock(BlockManagerInterface::class);
$blockManager->expects($this->any())->method('create')->willReturn(new Block());
Expand Down

0 comments on commit b76361f

Please sign in to comment.