From 151353a7f56f4a95315f5b693609af8136c7dcb5 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 3 Nov 2023 14:23:49 +1300 Subject: [PATCH] API Deprecate Versioned() having parameter --- src/Versioned.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Versioned.php b/src/Versioned.php index 8ffe981d..d165da41 100644 --- a/src/Versioned.php +++ b/src/Versioned.php @@ -12,6 +12,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\Core\Extension; use SilverStripe\Core\Resettable; +use SilverStripe\Dev\Deprecation; use SilverStripe\Forms\FieldList; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataExtension; @@ -2002,11 +2003,20 @@ public function stagesDiffer() * @param string $sort * @param string $limit * @param string $join Deprecated, use leftJoin($table, $joinClause) instead - * @param string $having + * @param string $having @deprecated 2.1.1 The $having parameter does nothing and will be removed without + * equivalent functionality to replace it * @return ArrayList */ public function Versions($filter = "", $sort = "", $limit = "", $join = "", $having = "") { + if ($having) { + Deprecation::withNoReplacement(function () { + $message = 'The $having parameter does nothing and will be removed without equivalent' + . ' functionality to replace it'; + Deprecation::notice('2.1.1', $message); + }); + } + /** @var DataObject $owner */ $owner = $this->owner; @@ -2020,9 +2030,6 @@ public function Versions($filter = "", $sort = "", $limit = "", $join = "", $hav static::set_stage(static::DRAFT); $list = DataObject::get(DataObject::getSchema()->baseDataClass($owner), $filter, $sort, $join, $limit); - if ($having) { - $list->having($having); - } $query = $list->dataQuery()->query();