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

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