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