/** * Renders the object to array * * @param array $arrAttributes Attribute array * @return array */ public function toArray(array $arrAttributes = array()) { $data = parent::toArray($arrAttributes); if ($stock = $this->getStockItem()) { $data['stock_item'] = $stock->toArray(); } unset($data['stock_item']['product']); return $data; }