protected function getPurchasable($purchasableId) { $purchasable = $this->getContainer()->get('elcodi.repository.purchasable')->find($purchasableId); if (!$purchasable instanceof PurchasableInterface) { throw new EntityNotFoundException(sprintf('Purchasable with id %d was not found', $purchasableId)); } return $purchasable; }