vendor/shopware/core/Framework/DataAbstractionLayer/Search/AggregationResult/AggregationResultCollection.php line 11

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\DataAbstractionLayer\Search\AggregationResult;
  3. use Shopware\Core\Framework\Log\Package;
  4. use Shopware\Core\Framework\Struct\Collection;
  5. use Shopware\Core\Framework\Struct\StateAwareTrait;
  6. /**
  7.  * @extends Collection<AggregationResult>
  8.  */
  9. #[Package('core')]
  10. class AggregationResultCollection extends Collection
  11. {
  12.     use StateAwareTrait;
  13.     /**
  14.      * @param AggregationResult $result
  15.      */
  16.     public function add($result): void
  17.     {
  18.         $this->set($result->getName(), $result);
  19.     }
  20.     /**
  21.      * @param string|int        $key
  22.      * @param AggregationResult $result
  23.      */
  24.     public function set($key$result): void
  25.     {
  26.         parent::set($result->getName(), $result);
  27.     }
  28.     public function get($name): ?AggregationResult
  29.     {
  30.         return $this->elements[$name] ?? null;
  31.     }
  32.     public function getApiAlias(): string
  33.     {
  34.         return 'dal_aggregation_result_cache';
  35.     }
  36.     protected function getExpectedClass(): ?string
  37.     {
  38.         return AggregationResult::class;
  39.     }
  40. }