vendor/shopware/core/Content/Cms/DataResolver/FieldConfigCollection.php line 14

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Cms\DataResolver;
  3. use Shopware\Core\Framework\Struct\Collection;
  4. /**
  5.  * @method FieldConfig[]    getIterator()
  6.  * @method FieldConfig[]    getElements()
  7.  * @method FieldConfig|null get(string $key)
  8.  * @method FieldConfig|null first()
  9.  * @method FieldConfig|null last()
  10.  */
  11. class FieldConfigCollection extends Collection
  12. {
  13.     /**
  14.      * @param FieldConfig $element
  15.      */
  16.     public function add($element): void
  17.     {
  18.         $this->set($element->getName(), $element);
  19.     }
  20.     /**
  21.      * @param string|int  $key
  22.      * @param FieldConfig $element
  23.      */
  24.     public function set($key$element): void
  25.     {
  26.         parent::set($element->getName(), $element);
  27.     }
  28.     public function getApiAlias(): string
  29.     {
  30.         return 'cms_data_resolver_field_config_collection';
  31.     }
  32.     protected function getExpectedClass(): ?string
  33.     {
  34.         return FieldConfig::class;
  35.     }
  36. }