Esempio n. 1
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}');
     }
 }