Skip to content

Commit

Permalink
API Deprecate Versions() having parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 5, 2023
1 parent 6415021 commit 4d38781
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Versioned.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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.2.0 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.2.0', $message);
});
}

/** @var DataObject $owner */
$owner = $this->owner;

Expand All @@ -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();

Expand Down

0 comments on commit 4d38781

Please sign in to comment.