Elcodi\Store\ProductBundle\Behat\Context::getCategory PHP Method

getCategory() protected method

Get category by id
protected getCategory ( integer $categoryId ) : Elcodi\Component\Product\Entity\Interfaces\CategoryInterface
$categoryId integer Category Id
return Elcodi\Component\Product\Entity\Interfaces\CategoryInterface Category
    protected function getCategory($categoryId)
    {
        $category = $this->getContainer()->get('elcodi.repository.category')->find($categoryId);
        if (!$category instanceof ProductInterface) {
            throw new EntityNotFoundException(sprintf('Category with id %d was not found', $categoryId));
        }
        return $category;
    }