/** * fromArray * * @param array $data */ public function fromArray(array $data) { parent::fromArray($data); if (isset($data['name'])) { $this->setName($data['name']); } }
/** * fromArray * * @param array $data */ public function fromArray(array $data) { parent::fromArray($data); if (isset($data['category'])) { if (is_numeric($data['category'])) { $category = $this->getEntityManager()->find('\\POS\\Model\\Entity\\Category', $data['category']); $this->setCategory($category); } else { $category = $this->getEntityManager()->getRepository('\\POS\\Model\\Entity\\Category')->findOneBy(['name' => $data['category']]); $this->setCategory($category); } } if (isset($data['name'])) { $this->setName($data['name']); } if (isset($data['price'])) { $this->setPrice($data['price']); } }
/** * fromArray * * @param array $data */ public function fromArray(array $data) { parent::fromArray($data); if (isset($data['cover'])) { $table = $this->getEntityManager()->find('\\POS\\Model\\Entity\\Table', $data['cover']); $this->setTable($table); } $this->setTime(new DateTime()); }