示例#1
0
 /**
  * @return Zone
  */
 public static function createUnclassifiedZone($localized = 'zone.unclassified')
 {
     $zone = new Zone();
     $zone->setName($localized);
     $zone->setPriority(self::UNCLASSIFIEDPRIORITY);
     return $zone;
 }
示例#2
0
 /**
  * @param Zone $zone
  * @return ZoneListDTO
  */
 public function toZoneListDTO(Zone $zone)
 {
     $zoneListDTO = new ZoneListDTO();
     $zoneListDTO->id = $zone->getId();
     $zoneListDTO->name = $zone->getName();
     $zoneListDTO->priority = $zone->getPriority();
     return $zoneListDTO;
 }
示例#3
0
 private function createZone($name, $priority)
 {
     $current = $this->init->zoneRepo->findOneBy(array('name' => $name));
     if (empty($current)) {
         $zone = Zone::registerZone($name, $priority);
         $this->init->zoneRepo->store($zone);
         return $zone;
     }
     return $current;
 }
 public function testZonePlanFunctions()
 {
     $addressAesch = $this->init->createTestAddressAesch();
     $zone = Zone::createUnclassifiedZone('Fernfahrt');
     $this->init->zoneRepo->store($zone);
     $zone = Zone::registerZone('kantonal123456', 2);
     $this->init->zoneRepo->store($zone);
     $zonePlan = ZonePlan::registerZonePlan('habakuck', '3231');
     $zonePlan->setZone($zone);
     $this->init->zonePlanRepo->store($zonePlan);
     $this->init->em->flush();
     $this->assertTrue($this->init->zoneRepo->checkIfNameAlreadyExist('kantonal123456'));
     $zoneAdd = $this->init->zonePlanManagement->getZoneForAddress($addressAesch);
     $this->assertNotNull($zoneAdd);
     $zoneCity = $this->init->zonePlanManagement->getZoneForCity('habakuck');
     $this->assertNotNull($zoneCity);
 }
 /**
  * @return Zone
  */
 private function getUnclassifiedZone()
 {
     /**
      * get zone with the highest priority (unclassified zones)
      * if the zone doen't exist, create and persist it
      * output: unclassified zone
      * note:   Fernfahrt == zone.unclassified (for testing only)
      */
     /** @var $oldZone Zone */
     $oldZone = $this->zoneRepository->findUnclassifiedZone();
     if (!is_null($oldZone)) {
         return $oldZone;
     }
     /** @var $newZone Zone */
     $newZone = Zone::createUnclassifiedZone('Fernfahrt');
     $this->zoneRepository->store($newZone);
     $this->getContainer()->get('entity_manager')->flush();
     return $this->zoneRepository->findUnclassifiedZone();
 }
示例#6
0
 /**
  * @param Zone $zone
  */
 public function setZone(Zone $zone)
 {
     $this->zone = $zone;
     $zone->assignZonePlan($this);
 }