vendor/shopware/core/Content/Seo/MainCategory/MainCategoryCollection.php line 16

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Seo\MainCategory;
  3. use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
  4. /**
  5.  * @method void                    add(MainCategoryEntity $entity)
  6.  * @method void                    set(string $key, MainCategoryEntity $entity)
  7.  * @method MainCategoryEntity[]    getIterator()
  8.  * @method MainCategoryEntity[]    getElements()
  9.  * @method MainCategoryEntity|null get(string $key)
  10.  * @method MainCategoryEntity|null first()
  11.  * @method MainCategoryEntity|null last()
  12.  */
  13. class MainCategoryCollection extends EntityCollection
  14. {
  15.     public function filterBySalesChannelId(string $id): MainCategoryCollection
  16.     {
  17.         return $this->filter(static function (MainCategoryEntity $mainCategory) use ($id) {
  18.             return $mainCategory->getSalesChannelId() === $id;
  19.         });
  20.     }
  21.     public function getApiAlias(): string
  22.     {
  23.         return 'seo_main_category_collection';
  24.     }
  25.     protected function getExpectedClass(): string
  26.     {
  27.         return MainCategoryEntity::class;
  28.     }
  29. }