Пример #1
0
 public function load(ObjectManager $manager)
 {
     $Player1 = new Player();
     $Player1->setName('Koko');
     $Player1->setLastname('Mueller');
     $Player1->setEmail('koko.developer@gmail.com');
     $Player1->setUsername('koko.developer@gmail.com');
     $Player1->setPassword(md5('koko'));
     $Player1->setBirthday(time());
     $Player1->setSports('1:2:4');
     $Player1->setGender(1);
     $Player1->setActivityradius(10);
     $Player1->setCreated(time());
     $Player1->setPopularity('bu');
     $Player1->setZipcode("56667");
     $Player1->setEvaluate('1');
     $Player1->setPlayerstatus(1);
     $Player1->setSkills('1:1:2');
     $Player1->setRegistered(1);
     $Player1->setOnline(0);
     $manager->persist($Player1);
     $manager->flush();
     $this->addReference('Player1', $Player1);
 }
 public function getPlayerEvents(Player $player)
 {
     $events = $this->findByPlayer($player->getId());
     return $events;
 }
Пример #3
0
 /**
  * Checks if a candidate is blocked by some other event
  * Checks for schedule collisions
  * @param \Sportnetzwerk\SpnBundle\Entity\Player $player
  * @param type $start current event start
  * @param type $end current event end
  */
 public function blockedByEvent(Player $player, $start, $end)
 {
     $blockedCandidate = array();
     $qb = $this->createQueryBuilder('pl')->where('pl.id = ?1')->innerJoin('SportnetzwerkSpnBundle:PlayerEvents', 'ple', 'with', 'ple.player = pl.id')->innerJoin('SportnetzwerkSpnBundle:Events', 'e', 'with', 'e.id = ple.event AND (e.start < ?2 AND e.end > ?3) AND ple.accepted = 1')->setParameters(array(1 => $player->getId(), 2 => $end, 3 => $start));
     $blockedCandidate = $qb->getQuery()->getResult();
     return empty($blockedCandidate) ? false : true;
 }