public function transform(\Entity\Brand $brand) { return ['id' => (int) $brand->getBrandId(), 'name' => $brand->getName(), 'links' => ['rel' => 'self', 'uri' => \Util\SlimUtil::absoluteUrlFor('brand_by_id', ['id' => $brand->getBrandId()]), 'method' => 'GET']]; }
/** * * @param \Entity\Brand $brand * @return boolean */ public function exists($brand) { $brands = $this->finByName($brand->getName()); return count($this->finByName($brand->getName())) > 0; }