From 2dd71de2592576c81932dda75635260ab0d9eac4 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Sun, 1 Oct 2023 20:40:44 +0200 Subject: [PATCH] Remove deprecated `Sort` class --- src/core/etl/src/Flow/ETL/DataFrame.php | 18 ++---------- src/core/etl/src/Flow/ETL/Row/Sort.php | 37 ------------------------- 2 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 src/core/etl/src/Flow/ETL/Row/Sort.php diff --git a/src/core/etl/src/Flow/ETL/DataFrame.php b/src/core/etl/src/Flow/ETL/DataFrame.php index c6138fb73..24ed3f7a6 100644 --- a/src/core/etl/src/Flow/ETL/DataFrame.php +++ b/src/core/etl/src/Flow/ETL/DataFrame.php @@ -27,7 +27,6 @@ use Flow\ETL\Row\Reference; use Flow\ETL\Row\References; use Flow\ETL\Row\Schema; -use Flow\ETL\Row\Sort; use Flow\ETL\Transformer\CallbackRowTransformer; use Flow\ETL\Transformer\CrossJoinRowsTransformer; use Flow\ETL\Transformer\DropDuplicatesTransformer; @@ -610,28 +609,15 @@ public function select(string|Reference ...$entries) : self /** * @lazy - * - * @psalm-suppress DeprecatedClass */ - public function sortBy(Sort|EntryReference ...$entries) : self + public function sortBy(EntryReference ...$entries) : self { $this ->cache($this->context->config->id()) ->run(); $this->pipeline = $this->pipeline->cleanCopy(); - - $sortBy = []; - - foreach ($entries as $entry) { - if ($entry instanceof Sort) { - $sortBy[] = $entry->isAsc() ? ref($entry->name())->asc() : ref($entry->name())->desc(); - } else { - $sortBy[] = $entry; - } - } - - $this->pipeline->source($this->context->config->externalSort()->sortBy(...$sortBy)); + $this->pipeline->source($this->context->config->externalSort()->sortBy(...$entries)); return $this; } diff --git a/src/core/etl/src/Flow/ETL/Row/Sort.php b/src/core/etl/src/Flow/ETL/Row/Sort.php deleted file mode 100644 index e3768f440..000000000 --- a/src/core/etl/src/Flow/ETL/Row/Sort.php +++ /dev/null @@ -1,37 +0,0 @@ -desc() or ref("col")->asc() instead - */ -final class Sort -{ - private function __construct( - private readonly string $column, - private readonly string $order - ) { - } - - public static function asc(string $column) : self - { - return new self($column, 'asc'); - } - - public static function desc(string $column) : self - { - return new self($column, 'desc'); - } - - public function isAsc() : bool - { - return $this->order === 'asc'; - } - - public function name() : string - { - return $this->column; - } -}