diff --git a/model/DataList.php b/model/DataList.php index 92af851e1..1984af0df 100644 --- a/model/DataList.php +++ b/model/DataList.php @@ -146,7 +146,10 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab * @param string $limit */ public function limit($limit, $offset = 0) { - if(!is_numeric($limit)) { + if(!$limit && !$offset) { + return $this; + } + if($limit && !is_numeric($limit)) { Deprecation::notice('3.0', 'Please pass limits as 2 arguments, rather than an array or SQL fragment.'); } $this->dataQuery->limit($limit, $offset); diff --git a/model/DataObject.php b/model/DataObject.php index ca972f6b2..f11ae58e2 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -1309,7 +1309,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * * @return HasManyList The components of the one-to-many relationship. */ - public function getComponents($componentName, $filter = "", $sort = "", $join = "", $limit = "") { + public function getComponents($componentName, $filter = "", $sort = "", $join = "", $limit = null) { $result = null; if(!$componentClass = $this->has_many($componentName)) {