Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
namespace VisualCraft\Bundle\VioskFrontendBundle\DataFixtures;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\Common\DataFixtures\SharedFixtureInterface;
use Hautelook\AliceBundle\Alice\DataFixtureLoader;
abstract class BaseDataFixtureLoader extends DataFixtureLoader implements OrderedFixtureInterface, SharedFixtureInterface
{
/**
* Fixture reference repository
*
* @var ReferenceRepository
*/
protected $referenceRepository;
/**
* {@inheritdoc}
*/
public function setReferenceRepository(ReferenceRepository $referenceRepository)
{
$this->referenceRepository = $referenceRepository;
}
/**
* Set the reference entry identified by $name
* and referenced to managed $object. If $name
* already is set, it overrides it
*
* @param string $name
* @param object $object - managed object
* @see Doctrine\Common\DataFixtures\ReferenceRepository::setReference
* @return void
*/
public function setReference($name, $object)
{
$this->referenceRepository->setReference($name, $object);
}
/**
* Set the reference entry identified by $name
* and referenced to managed $object. If $name
* already is set, it overrides it
*
* @param string $name
* @param object $object - managed object
* @see Doctrine\Common\DataFixtures\ReferenceRepository::addReference
* @return void
*/
public function addReference($name, $object)
{
$this->referenceRepository->addReference($name, $object);
}
/**
* Loads an object using stored reference
* named by $name
*
* @param string $name
* @see Doctrine\Common\DataFixtures\ReferenceRepository::getReference
* @return object
*/
public function getReference($name)
{
return $this->referenceRepository->getReference($name);
}
/**
* Check if an object is stored using reference
* named by $name
*
* @param string $name
* @see Doctrine\Common\DataFixtures\ReferenceRepository::hasReference
* @return boolean
*/
public function hasReference($name)
{
return $this->referenceRepository->hasReference($name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment