Last active
August 29, 2015 14:10
-
-
Save bramstroker/82b69036f8cb5b116218 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$campsite = $campsiteRepo->find(100011); | |
$ranking = $campsite->getRanking(); | |
$ranking = $rankingRepo->findOneBy(['campsite' => 100011]); | |
$campsite = $ranking->getCampsite(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* RankingLoader | |
* | |
* @category CampsiteRankingFixture | |
* @package CampsiteRankingFixture | |
* @copyright 2014 ACSI Holding bv (http://www.acsi.eu) | |
* @version SVN: $Id$ | |
*/ | |
namespace CampsiteRankingFixture; | |
use AcsiCampsite\Entity\Ranking; | |
use Doctrine\Common\DataFixtures\AbstractFixture; | |
use Doctrine\Common\DataFixtures\DependentFixtureInterface; | |
use Doctrine\Common\Persistence\ObjectManager; | |
class RankingLoader extends AbstractFixture implements DependentFixtureInterface | |
{ | |
/** | |
* @param ObjectManager $manager | |
*/ | |
public function load(ObjectManager $manager) | |
{ | |
$ranking = new Ranking(); | |
$ranking->setCampsite($this->getReference('campsite-100000')); | |
$ranking->setRankEurocampings(3); | |
$ranking->setRankCca(4); | |
$ranking->setIsCampsiteOfTheWeek(true); | |
$ranking->setIsThemeTopCca(false); | |
$ranking->setIsThemeTopEurocampings(false); | |
$ranking->setPercentageClicksConsumed(20); | |
$this->addReference('ranking-1', $ranking); | |
$manager->persist($ranking); | |
$manager->flush(); | |
} | |
/** | |
* This method must return an array of fixtures classes | |
* on which the implementing class depends on | |
* | |
* @return array | |
*/ | |
function getDependencies() | |
{ | |
return['CampsiteDetailsFixture\CampsiteDetailsLoader']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment