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

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. use Shopware\Core\Framework\Log\Package;
  6. /**
  7.  * @extends EntityCollection<CmsSectionEntity>
  8.  */
  9. #[Package('content')]
  10. class CmsSectionCollection extends EntityCollection
  11. {
  12.     public function getBlocks(): CmsBlockCollection
  13.     {
  14.         $blocks = new CmsBlockCollection();
  15.         /** @var CmsSectionEntity $section */
  16.         foreach ($this->elements as $section) {
  17.             if (!$section->getBlocks()) {
  18.                 continue;
  19.             }
  20.             $blocks->merge($section->getBlocks());
  21.         }
  22.         return $blocks;
  23.     }
  24.     public function getApiAlias(): string
  25.     {
  26.         return 'cms_page_section_collection';
  27.     }
  28.     protected function getExpectedClass(): string
  29.     {
  30.         return CmsSectionEntity::class;
  31.     }
  32. }