Esempio n. 1
0
 public function load(\Doctrine\Common\Persistence\ObjectManager $manager)
 {
     $this->loadCountry($manager);
     $country = $manager->getRepository('UnrLabDomainBundle:Country')->findOneBy(array('code' => 'FR'));
     $superAdmin = new SuperAdmin('admin', md5('admin'));
     $superAdmin->setFirstname('macha')->setLastname('Grimm')->setEmail('*****@*****.**');
     $billUser = new BillUser('bill', md5('bill'));
     $billUser->setFirstname('Bill')->setLastname('User')->setEmail('*****@*****.**');
     $billUser1 = new BillUser('tom', md5('tom'));
     $billUser1->setFirstname('Tom')->setLastname('Tom')->setEmail('*****@*****.**');
     $manager->persist($superAdmin);
     $manager->persist($billUser);
     $manager->persist($billUser1);
     $manager->flush();
     $company = new Company();
     $company->setName('Supa dupa corp')->setReference('SDC')->setSiren('123456789')->addUser($billUser)->setAddress1('2, place Masséna')->setCp('06000')->setCity('Nice')->setCountry($country);
     $company1 = new Company();
     $company1->setName('GPS corp')->setReference('GPSC')->setSiren('987654321')->addUser($billUser1)->setAddress1('2, avenue des champs élysées')->setCp('75000')->setCity('Paris')->setCountry($country);
     $manager->persist($company);
     $manager->persist($company1);
     $manager->flush();
 }
Esempio n. 2
0
 /**
  * @JMS\PreSerialize
  */
 public function preSerialize()
 {
     if ($this->status) {
         $this->links['status'] = $this->buildLinks(array($this->status->getId()), '/status/{id}', '{id}');
     }
     if ($this->company) {
         $this->links['company'] = $this->buildLinks(array($this->company->getId()), '/companies/{id}', '{id}');
     }
     if ($this->customer) {
         $this->links['customer'] = $this->buildLinks(array($this->customer->getId()), '/customers/{id}', '{id}');
     }
     if (count($this->lines) > 0) {
         $lineIds = array();
         foreach ($this->lines as $line) {
             $lineIds[] = $line->getId();
         }
         $this->links['lines'] = $this->buildLinks($lineIds, '/lines/{id}', '{id}');
     }
 }
Esempio n. 3
0
 /**
  * @JMS\PreSerialize
  */
 public function preSerialize()
 {
     if ($this->country) {
         $this->links['country'] = $this->buildLinks(array($this->country->getId()), '/countries/{id}', '{id}');
     }
     if ($this->company) {
         $this->links['company'] = $this->buildLinks(array($this->company->getId()), '/companies/{id}', '{id}');
     }
     if (count($this->bills) > 0) {
         $billIds = array();
         foreach ($this->bills as $bill) {
             $billIds[] = $bill->getId();
         }
         $this->links['bills'] = $this->buildLinks($billIds, '/bills/{id}', '{id}');
     }
 }
Esempio n. 4
0
 /**
  * @JMS\PreSerialize
  */
 public function preSerialize()
 {
     if ($this->company) {
         $this->links['company'] = $this->buildLinks([$this->company->getId()], '/companies/{id}', '{id}');
     }
 }