vendor/shopware/core/Content/Cms/Aggregate/CmsSection/CmsSectionCollection.php line 11

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Cms\Aggregate\CmsSection;
  3. use Shopware\Core\Content\Cms\Aggregate\CmsBlock\CmsBlockCollection;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
  5. /**
  6.  * @extends EntityCollection<CmsSectionEntity>
  7.  */
  8. class CmsSectionCollection extends EntityCollection
  9. {
  10.     public function getBlocks(): CmsBlockCollection
  11.     {
  12.         $blocks = new CmsBlockCollection();
  13.         /** @var CmsSectionEntity $section */
  14.         foreach ($this->elements as $section) {
  15.             if (!$section->getBlocks()) {
  16.                 continue;
  17.             }
  18.             $blocks->merge($section->getBlocks());
  19.         }
  20.         return $blocks;
  21.     }
  22.     public function getApiAlias(): string
  23.     {
  24.         return 'cms_page_section_collection';
  25.     }
  26.     protected function getExpectedClass(): string
  27.     {
  28.         return CmsSectionEntity::class;
  29.     }
  30. }