/** * @param $picture * @return null|string */ private function getWebPath($picture) { $productCategory = new ProductCategory(); return null === $picture ? null : $productCategory->getUploadDir() . $picture; }
/** * Get All By Category * * @param ProductCategory $category * @param integer $max * @return PaginatorService */ public function getAllByCategory(ProductCategory $category, $max = 6) { $query = $this->getRepository()->createQueryBuilder('p')->where('p.isActive = :isActive')->andWhere('p.category IN (:categories)')->setParameter('isActive', true)->setParameter('categories', $category->getChildren())->orderBy('p.createdAt', 'DESC')->getQuery()->setMaxResults($max); return $query->getResult(); }