vendor/kobizo/ecommerce-bundle/src/Security/Voter/ProductCategoryVoter.php line 9

Open in your IDE?
  1. <?php
  2. namespace Kobizo\Bundle\ECommerceBundle\Security\Voter;
  3. use Kobizo\Bundle\CoreBundle\Security\Voter\KobizoVoter;
  4. use Kobizo\Component\Entity\Term;
  5. use Kobizo\Component\Resources\AccessControl\ProductCategoryResource;
  6. class ProductCategoryVoter extends KobizoVoter
  7. {
  8.     protected function supports($attribute$subject): bool
  9.     {
  10.         if (!in_array($attributeProductCategoryResource::getAllResources())) {
  11.             return false;
  12.         }
  13.         if (!$subject instanceof Term
  14.             && !in_array($attribute, [ProductCategoryResource::INDEXProductCategoryResource::CREATE])
  15.         ) {
  16.             return false;
  17.         }
  18.         return true;
  19.     }
  20. }