/** * @return Collection */ public function getAddressesCollection() { $collection = $this->_addressCollectionFactory->create()->setOrderFilter($this); if ($this->getId()) { foreach ($collection as $address) { $address->setOrder($this); } } return $collection; }
/** * @return Collection */ public function getAddressesCollection() { if (is_null($this->_addresses)) { $this->_addresses = $this->_addressCollectionFactory->create()->setOrderFilter($this); if ($this->getId()) { foreach ($this->_addresses as $address) { $address->setOrder($this); } } } return $this->_addresses; }