src/Migration/Loader/DataFixturesLoader.php
protected function isFixtureAlreadyLoaded($fixtureObject)
    {
        if (!$this->loadedFixtures) {
            $this->loadedFixtures = [];

            $loadedFixtures = $this->em->getRepository('OkvpnFixtureBundle:DataFixture')->findAll();
            /** @var DataFixture $fixture */
            foreach ($loadedFixtures as $fixture) {
                $this->loadedFixtures[$fixture->getClassName()] = $fixture->getVersion() ?: '0.0';
            }
        }

        $alreadyLoaded = false;

        if (isset($this->loadedFixtures[get_class($fixtureObject)])) {
            $alreadyLoaded = true;
            $loadedVersion = $this->loadedFixtures[get_class($fixtureObject)];
            if ($fixtureObject instanceof VersionedFixtureInterface
                && version_compare($loadedVersion, $fixtureObject->getVersion()) == -1
            ) {
                if ($fixtureObject instanceof LoadedFixtureVersionAwareInterface) {
                    $fixtureObject->setLoadedVersion($loadedVersion);
                }
                $alreadyLoaded = false;
            }
        }

        return $alreadyLoaded;
    }
protected function isFixtureAlreadyLoaded($fixtureObject)
    {
        if (!$this->loadedFixtures) {
            $this->loadedFixtures = [];

            $loadedFixtures = $this->em->getRepository('OkvpnFixtureBundle:DataFixture')->findAll();
            /** @var DataFixture $fixture */
            foreach ($loadedFixtures as $fixture) {
                $this->loadedFixtures[$fixture->getClassName()] = $fixture->getVersion() ?: '0.0';
            }
        }

        $alreadyLoaded = false;

        if (isset($this->loadedFixtures[get_class($fixtureObject)])) {
            $alreadyLoaded = true;
            $loadedVersion = $this->loadedFixtures[get_class($fixtureObject)];
            if ($fixtureObject instanceof VersionedFixtureInterface
                && version_compare($loadedVersion, $fixtureObject->getVersion()) == -1
            ) {
                if ($fixtureObject instanceof LoadedFixtureVersionAwareInterface) {
                    $fixtureObject->setLoadedVersion($loadedVersion);
                }
                $alreadyLoaded = false;
            }
        }

        return $alreadyLoaded;
    }
protected function isFixtureAlreadyLoaded ( $ fixtureObject ) { if ( ! $ this -> loadedFixtures ) { $ this -> loadedFixtures = [ ] ; $ loadedFixtures = $ this -> em -> getRepository ( 'OkvpnFixtureBundle:DataFixture' ) -> findAll ( ) ; /** @var DataFixture $fixture */ foreach ( $ loadedFixtures as $ fixture ) { $ this -> loadedFixtures [ $ fixture -> getClassName ( ) ] = $ fixture -> getVersion ( ) ? : '0.0' ; } } $ alreadyLoaded = false ; if ( isset ( $ this -> loadedFixtures [ get_class ( $ fixtureObject ) ] ) ) { $ alreadyLoaded = true ; $ loadedVersion = $ this -> loadedFixtures [ get_class ( $ fixtureObject ) ] ; if ( $ fixtureObject instanceof VersionedFixtureInterface && version_compare ( $ loadedVersion , $ fixtureObject -> getVersion ( ) ) == - 1 ) { if ( $ fixtureObject instanceof LoadedFixtureVersionAwareInterface ) { $ fixtureObject -> setLoadedVersion ( $ loadedVersion ) ; } $ alreadyLoaded = false ; } } return $ alreadyLoaded ; }
Determines whether the given data fixture is already loaded or not

@param object $fixtureObject

@return bool
Determines whether the given data fixture is already loaded or not