/** * @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}'); } }
/** * @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}'); } }
/** * @JMS\PreSerialize */ public function preSerialize() { if ($this->company) { $this->links['company'] = $this->buildLinks([$this->company->getId()], '/companies/{id}', '{id}'); } }