Skip to content

Commit

Permalink
Merge pull request #425 from creative-commoners/pulls/2.1/deprecate-h…
Browse files Browse the repository at this point in the history
…aving

API Deprecate Versions() having parameter
  • Loading branch information
GuySartorelli authored Nov 5, 2023
2 parents 6a15edb + 4d38781 commit cccdb23
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Versioned.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use SilverStripe\Core\Extension;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Resettable;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataExtension;
Expand Down Expand Up @@ -2015,11 +2016,20 @@ public function stagesDifferRecursive(): bool
* @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 @@ -2033,9 +2043,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 cccdb23

Please sign in to comment.