Sulu\Bundle\CategoryBundle\Entity\CategoryRepositoryInterface::findCategoryByKey PHP Method

findCategoryByKey() public method

If no respective category is found, null is returned.
public findCategoryByKey ( string $key ) : Sulu\Bundle\CategoryBundle\Entity\CategoryInterface | null
$key string
return Sulu\Bundle\CategoryBundle\Entity\CategoryInterface | null
    public function findCategoryByKey($key);

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function findByKey($key)
 {
     if (!($entity = $this->categoryRepository->findCategoryByKey($key))) {
         throw new CategoryKeyNotFoundException($key);
     }
     return $entity;
 }