Example #1
0
 /**
  * @param Country $country
  *
  * @return array|Mandate[]
  */
 public function getMandates(Country $country) : array
 {
     $datas = $this->manager->getDBResults('@Api/sql/elects/getMandates.sql.twig', ['country' => $country->getId()]);
     $mandates = [];
     foreach ($datas as $data) {
         $data = ArraysUtils::toMultiDimensional($data);
         $mandates[] = $this->hydrator->hydrateMandate($data['id'], $data['name'], $data['wikipedia'], $this->hydrator->hydrateZoneType($data['zone_type']['id'], $data['zone_type']['name'], $data['zone_type']['slug'], $data['zone_type']['level'], $country));
     }
     return $mandates;
 }
Example #2
0
 /**
  * @param Country $country
  *
  * @return array|ZoneType[]
  *
  * @throws DBALException
  */
 public function getZonesTypes(Country $country) : array
 {
     $results = $this->manager->getDBResults('@Api/sql/zones/getZonesTypes.sql.twig', ['country' => $country->getId()]);
     $zonesTypes = [];
     foreach ($results as $zt) {
         $zonesTypes[] = $this->hydrator->hydrateZoneType($zt['id'], $zt['name'], $zt['slug'], $zt['level'], $country);
     }
     return $zonesTypes;
 }