Upgrade to 3.6.0

This commit is contained in:
Bastian Allgeier
2021-11-16 14:53:37 +01:00
parent 7388fa4d24
commit 92b7a330fa
318 changed files with 20017 additions and 6878 deletions

View File

@@ -2,8 +2,9 @@
namespace Kirby\Cms;
use Kirby\Toolkit\Dir;
use Kirby\Toolkit\F;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Filesystem\Dir;
use Kirby\Filesystem\F;
use Kirby\Toolkit\Str;
/**
@@ -37,12 +38,13 @@ class Users extends Collection
* an entire second collection to the
* current collection
*
* @param mixed $object
* @param \Kirby\Cms\Users|\Kirby\Cms\User|string $object
* @return $this
* @throws \Kirby\Exception\InvalidArgumentException When no `User` or `Users` object or an ID of an existing user is passed
*/
public function add($object)
{
// add a page collection
// add a users collection
if (is_a($object, self::class) === true) {
$this->data = array_merge($this->data, $object->data);
@@ -53,6 +55,11 @@ class Users extends Collection
// add a user object
} elseif (is_a($object, 'Kirby\Cms\User') === true) {
$this->__set($object->id(), $object);
// give a useful error message on invalid input;
// silently ignore "empty" values for compatibility with existing setups
} elseif (in_array($object, [null, false, true], true) !== true) {
throw new InvalidArgumentException('You must pass a Users or User object or an ID of an existing user to the Users collection');
}
return $this;