Skip to content

Commit

Permalink
API Remove deprecated parameter from DataObject::get()
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 7, 2025
1 parent 3871869 commit 256c95a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/ORM/DataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3419,7 +3419,6 @@ public function getReverseAssociation($className)
* Supports parameterised queries. See SQLSelect::addWhere() for syntax examples.
* @param string|array|null $sort Passed to DataList::sort()
* BY clause. If omitted, DataObject::$default_sort will be used.
* @param string $join Deprecated 3.0 Join clause. Use leftJoin($table, $joinClause) instead.
* @param string|array $limit A limit expression to be inserted into the LIMIT clause.
* @param string $containerClass The container class to return the results in.
*
Expand All @@ -3429,7 +3428,6 @@ public static function get(
$callerClass = null,
$filter = "",
$sort = "",
$join = "",
$limit = null,
$containerClass = DataList::class
) {
Expand All @@ -3439,18 +3437,13 @@ public static function get(
if ($callerClass === DataObject::class) {
throw new InvalidArgumentException('Call <classname>::get() instead of DataObject::get()');
}
if ($filter || $sort || $join || $limit || ($containerClass !== DataList::class)) {
if ($filter || $sort || $limit || ($containerClass !== DataList::class)) {
throw new InvalidArgumentException('If calling <classname>::get() then you shouldn\'t pass any other'
. ' arguments');
}
} elseif ($callerClass === DataObject::class) {
throw new InvalidArgumentException('DataObject::get() cannot query non-subclass DataObject directly');
}
if ($join) {
throw new InvalidArgumentException(
'The $join argument has been removed. Use leftJoin($table, $joinClause) instead.'
);
}

// Build and decorate with args
$result = DataList::create($callerClass);
Expand Down
2 changes: 1 addition & 1 deletion tests/php/ORM/DataObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public function testGet()
$this->assertEquals('Phil', $comments->first()->Name);

// Test limit
$comments = DataObject::get(DataObjectTest\TeamComment::class, '', "\"Name\" ASC", '', '1,2');
$comments = DataObject::get(DataObjectTest\TeamComment::class, '', "\"Name\" ASC", '1,2');
$this->assertEquals(2, $comments->count());
$this->assertEquals('Joe', $comments->first()->Name);
$this->assertEquals('Phil', $comments->last()->Name);
Expand Down

0 comments on commit 256c95a

Please sign in to comment.