From 6521e170819c705e3c9e7d14cb9c334e6355c91c Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Wed, 29 Nov 2017 12:20:04 +0100 Subject: [PATCH] Fix strict comparison in DependentFixtureInterface See https://github.com/doctrine/DoctrineFixturesBundle/pull/216#issuecomment-349077657 --- Loader/SymfonyFixturesLoader.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Loader/SymfonyFixturesLoader.php b/Loader/SymfonyFixturesLoader.php index 43766069..cac5c8ab 100644 --- a/Loader/SymfonyFixturesLoader.php +++ b/Loader/SymfonyFixturesLoader.php @@ -40,15 +40,10 @@ public function addFixtures(array $fixtures) public function addFixture(FixtureInterface $fixture) { $class = get_class($fixture); - if (isset($this->loadedFixtures[$class]) && $this->loadedFixtures[$class] !== $fixture) { - throw new \LogicException(sprintf( - 'The "%s" fixture class is already loaded and instantiated. It is not possible to add a new instance of this fixture. Upgrade to "doctrine/data-fixtures" version 1.3 or higher to support this.', - $class - )); + if (!isset($this->loadedFixtures[$class])) { + $this->loadedFixtures[$class] = $fixture; } - $this->loadedFixtures[$class] = $fixture; - // see https://github.com/doctrine/data-fixtures/pull/274 // this is to give a clear error if you do not have this version if (!method_exists(Loader::class, 'createFixture')) {