Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Remove deprecated parameter from DataObject::get() #11536

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading