Upgrade to 3.2.5

This commit is contained in:
Bastian Allgeier
2019-09-24 11:00:59 +02:00
parent ff9b5b1861
commit 447a9dd266
234 changed files with 1990 additions and 1224 deletions

View File

@@ -101,23 +101,22 @@ class Collection extends BaseCollection
/**
* Appends an element to the data array
*
* @param mixed $key
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return Kirby\Cms\Collection
* @return \Kirby\Cms\Collection
*/
public function append(...$args)
{
if (count($args) === 1) {
if (is_object($args[0]) === true) {
$this->data[$args[0]->id()] = $args[0];
// try to determine the key from the provided item
if (is_object($args[0]) === true && is_callable([$args[0], 'id']) === true) {
return parent::append($args[0]->id(), $args[0]);
} else {
$this->data[] = $args[0];
return parent::append($args[0]);
}
} elseif (count($args) === 2) {
$this->set($args[0], $args[1]);
}
return $this;
return parent::append(...$args);
}
/**
@@ -126,7 +125,7 @@ class Collection extends BaseCollection
*
* @param string $field
* @param bool $i Ignore upper/lowercase for group names
* @return Kirby\Cms\Collection
* @return \Kirby\Cms\Collection
*/
public function groupBy($field, bool $i = true)
{
@@ -165,7 +164,7 @@ class Collection extends BaseCollection
* Checks if the given object or id
* is in the collection
*
* @param string|object
* @param string|object $id
* @return boolean
*/
public function has($id): bool
@@ -197,8 +196,8 @@ class Collection extends BaseCollection
/**
* Returns a Collection without the given element(s)
*
* @param mixed[] $keys any number of keys, passed as individual arguments
* @return Kirby\Cms\Collection
* @param mixed ...$keys any number of keys, passed as individual arguments
* @return \Kirby\Cms\Collection
*/
public function not(...$keys)
{
@@ -217,7 +216,8 @@ class Collection extends BaseCollection
/**
* Add pagination and return a sliced set of data.
*
* @return Kirby\Cms\Collection
* @param mixed ...$arguments
* @return \Kirby\Cms\Collection
*/
public function paginate(...$arguments)
{
@@ -230,13 +230,34 @@ class Collection extends BaseCollection
/**
* Returns the parent model
*
* @return Kirby\Cms\Model
* @return \Kirby\Cms\Model
*/
public function parent()
{
return $this->parent;
}
/**
* Prepends an element to the data array
*
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return Kirby\Cms\Collection
*/
public function prepend(...$args)
{
if (count($args) === 1) {
// try to determine the key from the provided item
if (is_object($args[0]) === true && is_callable([$args[0], 'id']) === true) {
return parent::prepend($args[0]->id(), $args[0]);
} else {
return parent::prepend($args[0]);
}
}
return parent::prepend(...$args);
}
/**
* Runs a combination of filterBy, sortBy, not
* offset, limit, search and paginate on the collection.