Exemplo n.º 1
0
 /**
  * @return array
  */
 public function getGroups()
 {
     $rows = $this->repository->findGroups();
     $nbRows = count($rows);
     $groups = [];
     for ($i = 0; $i < $nbRows; ++$i) {
         $data = $rows[$i];
         $groups[] = (new Group())->setId($data['id'])->setName($data['name'])->setType((new GroupType())->setLabel($data['label']))->setDescription($data['description'])->setContact((new Member())->setIdentity($data['identity']))->setCreatedAt(new \DateTime($data['created_at']))->setUpdatedAt(new \DateTime($data['updated_at']));
     }
     return $groups;
 }
 public function testFindGroups()
 {
     $groups = $this->repository->findGroups();
     $this->assertCount(3, $groups);
     $this->assertEquals([['id' => '1', 'name' => 'Développeurs', 'description' => 'Equipe de développement du site', 'contact_id' => '1', 'identity' => 'John Doe', 'is_public' => '0', 'created_at' => '2015-08-22 15:30:00', 'updated_at' => '2015-09-01 23:54:32', 'label' => 'groups.thematic', 'type_id' => '2'], ['id' => '3', 'name' => 'Normandie', 'description' => 'Groupe régional de Normandie', 'contact_id' => '2', 'identity' => 'Alexander', 'is_public' => '1', 'created_at' => '2014-05-17 10:30:00', 'updated_at' => '2014-12-15 17:52:50', 'label' => 'groups.regional', 'type_id' => '1'], ['id' => '2', 'name' => 'Île-de-France', 'description' => "Groupe régional d'Île-de-France", 'contact_id' => '1', 'identity' => 'John Doe', 'is_public' => '1', 'created_at' => '2013-10-13 14:07:00', 'updated_at' => '2013-10-13 14:07:00', 'label' => 'groups.regional', 'type_id' => '1']], $groups);
 }
Exemplo n.º 3
0
 /**
  * @param int  $typeId
  * @param int  $minRange
  * @param int  $maxRange
  * @param bool $raw
  *
  * @return array
  */
 public function getGroups($typeId = null, $minRange = null, $maxRange = null, $raw = true)
 {
     return $this->repository->findGroups($typeId, $minRange, $maxRange, $raw);
 }