vendor/shopware/core/Framework/DataAbstractionLayer/Search/Sorting/FieldSorting.php line 8

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Search\CriteriaPartInterface;
  4. use Shopware\Core\Framework\Struct\Struct;
  5. class FieldSorting extends Struct implements CriteriaPartInterface
  6. {
  7.     public const ASCENDING 'ASC';
  8.     public const DESCENDING 'DESC';
  9.     /**
  10.      * @var string
  11.      */
  12.     protected $field;
  13.     /**
  14.      * @var string
  15.      */
  16.     protected $direction;
  17.     /**
  18.      * @var bool
  19.      */
  20.     protected $naturalSorting;
  21.     public function __construct(
  22.         string $field,
  23.         string $direction self::ASCENDING,
  24.         bool $naturalSorting false
  25.     ) {
  26.         $this->field $field;
  27.         $this->direction $direction;
  28.         $this->naturalSorting $naturalSorting;
  29.     }
  30.     public function getField(): string
  31.     {
  32.         return $this->field;
  33.     }
  34.     public function getFields(): array
  35.     {
  36.         return [$this->field];
  37.     }
  38.     public function getDirection(): string
  39.     {
  40.         return $this->direction;
  41.     }
  42.     public function getNaturalSorting(): bool
  43.     {
  44.         return $this->naturalSorting;
  45.     }
  46.     public function getApiAlias(): string
  47.     {
  48.         return 'dal_field_sorting';
  49.     }
  50. }