API CHANGE DataObject::getComponents() should use default value for limit as NULL

This commit is contained in:
Stig Lindqvist 2012-03-09 15:15:55 +13:00
parent 426f16764c
commit 2cb67efe07
2 changed files with 5 additions and 2 deletions

View File

@ -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);

View File

@ -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)) {