Example #1
0
 protected function getPlayer($id, $name)
 {
     $player = new Player();
     $player->setId($id);
     $player->setName($name);
     return $player;
 }
Example #2
0
 public function setUp()
 {
     $this->player1 = new Player();
     $this->player1->setName('Foo');
     $this->player2 = new Player();
     $this->player2->setName('Bar');
     $this->team = new Team($this->player1, $this->player2);
 }
Example #3
0
 /**
  * @param Player $player
  *
  * @return PointLog[]
  */
 public function getForPlayer(Player $player)
 {
     $sql = "\n            SELECT\n                *\n            FROM\n                pointlog pl\n            LEFT JOIN\n                match m ON m.id = pl.match_id\n            WHERE\n                m.player1_id = :id\n                OR\n                m.player2_id = :id\n                OR\n                m.team1attack = :id\n                OR\n                m.team1defence = :id\n                OR\n                m.team2attack = :id\n                OR\n                m.team2defence = :id\n            ORDER BY\n                m.date DESC";
     $rsm = new ResultSetMappingBuilder($this->_em);
     $rsm->addRootEntityFromClassMetadata('Application\\Model\\Entity\\PointLog', 'pl');
     $query = $this->_em->createNativeQuery($sql, $rsm);
     $query->setParameter('id', $player->getId());
     $logs = $query->getResult();
     return $logs;
 }
Example #4
0
 public function testExchangeArrayWithEmptyArray()
 {
     $this->player->exchangeArray(array());
     $this->assertThat($this->player, new PlayerConstraint(null, null));
 }