| Methods |
private
static
|
_addToAdd(object $parent, object $object, array<mixed> $addArgs, bool $skipAdd = false): void
|
#
|
public
static
|
addTo(object $parent, array<mixed> $defaults = [], array<mixed> $addArgs = [], bool $skipAdd = false): static
Initialize and add new object into parent. The new object is asserted to be an instance of current class.
Initialize and add new object into parent. The new object is asserted to be an instance of current class.
The best, typehinting-friendly, way to create an object if it should be immediately
added to a parent (otherwise use fromSeed() method).
$crud = Crud::addTo($app, ['displayFields' => ['name']]);
is equivalent to
$crud = $app->add(['Crud', 'displayFields' => ['name']]);
but the first one design pattern is strongly recommended as it supports refactoring.
|
#
|
public
static
|
addToWithCl(object $parent, array<mixed>|object $seed = [], array<mixed> $addArgs = [], bool $skipAdd = false): static
Same as addTo(), but the first element of seed specifies a class name instead of static::class.
Same as addTo(), but the first element of seed specifies a class name instead of static::class.
Parameters
| $seed |
the first element specifies a class name, other elements are seed
|
|
#
|
public
static
|
addToWithClUnsafe(
object $parent,
array<mixed>|object $seed = [],
array<mixed> $addArgs = [],
bool $skipAdd = false,
): static
Same as addToWithCl(), but the new object is not asserted to be an instance of this class.
Same as addToWithCl(), but the new object is not asserted to be an instance of this class.
Parameters
| $seed |
the first element specifies a class name, other elements are seed
|
|
#
|