public function load(ObjectManager $manager)
 {
     foreach ($this->getAllSites() as $singleSite) {
         $site = new Site();
         $site->setName($singleSite['name']);
         $site->setUrl($singleSite['url']);
         $manager->persist($site);
     }
     $manager->flush();
 }
示例#2
0
 /**
  * Initialize Vote with required data.
  *
  * @param Vote     $vote
  * @param User     $user
  * @param Site     $site
  * @param Annuaire $annuaire
  * @param $tracker
  * @param $point
  *
  * @return Vote
  */
 public function initVote(Vote $vote, User $user, Site $site, Annuaire $annuaire, $tracker, $point)
 {
     if ($site->getAnnuaires()->contains($annuaire)) {
         $vote->setUser($user);
         $vote->setSite($site);
         $vote->setAnnuaire($annuaire);
         $vote->setTracker($tracker);
         $vote->setPoint($point);
     } else {
         //@todo Générer une exception !
     }
     return $vote;
 }
示例#3
0
 /**
  * Updates an site.
  *
  * @param Site    $site
  * @param Boolean $andFlush Whether to flush the changes (default true)
  */
 public function updateSite(Site $site, $andFlush = true)
 {
     $this->objectManager->persist($site->getValidation());
     $this->objectManager->persist($site);
     if ($andFlush) {
         $this->objectManager->flush();
     }
 }