Ejemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $district = new District();
     $district->setId(19);
     $district->setLabel('United States');
     $district->setDistrictType(District::NATIONAL_EXEC);
     $this->addReference('district_us', $district);
     $manager->persist($district);
     $manager->flush();
 }
Ejemplo n.º 2
0
 protected function createDistrict($district)
 {
     $currentDistrict = $this->entityManager->getRepository('CivixCoreBundle:District')->findOneById($district->id);
     if (!$currentDistrict) {
         $currentDistrict = new District();
         $currentDistrict->setId($district->id);
         $currentDistrict->setLabel($district->label);
         //set district type (for Nonlegislave district type = LOCAL)
         if ($district->district_type != 'CENSUS') {
             $currentDistrict->setDistrictType(constant('Civix\\CoreBundle\\Entity\\District::' . $district->district_type));
         } else {
             $currentDistrict->setDistrictType(District::LOCAL);
         }
         $this->entityManager->persist($currentDistrict);
         $this->entityManager->flush($currentDistrict);
     }
     return $currentDistrict;
 }
 public function setId($id)
 {
     $this->__load();
     return parent::setId($id);
 }