Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Custom ORMPurger #347

Merged
merged 3 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\Common\DataFixtures\Executor;

use Doctrine\Common\DataFixtures\Event\Listener\ORMReferenceListener;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\Common\DataFixtures\Purger\ORMPurgerInterface;
use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\ORM\EntityManagerInterface;

Expand All @@ -22,7 +22,7 @@ class ORMExecutor extends AbstractExecutor
*
* @param EntityManagerInterface $em EntityManagerInterface instance used for persistence.
*/
public function __construct(EntityManagerInterface $em, ?ORMPurger $purger = null)
public function __construct(EntityManagerInterface $em, ?ORMPurgerInterface $purger = null)
{
$this->em = $em;
if ($purger !== null) {
Expand Down
6 changes: 2 additions & 4 deletions lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Class responsible for purging databases of data before reloading data fixtures.
*/
class ORMPurger implements PurgerInterface
class ORMPurger implements PurgerInterface, ORMPurgerInterface
{
public const PURGE_MODE_DELETE = 1;
public const PURGE_MODE_TRUNCATE = 2;
Expand Down Expand Up @@ -76,9 +76,7 @@ public function getPurgeMode()
return $this->purgeMode;
}

/**
* Set the EntityManagerInterface instance this purger instance should use.
*/
/** @inheritDoc */
public function setEntityManager(EntityManagerInterface $em)
{
$this->em = $em;
Expand Down
20 changes: 20 additions & 0 deletions lib/Doctrine/Common/DataFixtures/Purger/ORMPurgerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Doctrine\Common\DataFixtures\Purger;

use Doctrine\ORM\EntityManagerInterface;

/**
* ORMPurgerInterface
*/
interface ORMPurgerInterface
kissifrot marked this conversation as resolved.
Show resolved Hide resolved
{
/**
* Set the EntityManagerInterface instance this purger instance should use.
*
* @return void
*/
public function setEntityManager(EntityManagerInterface $em);
}