ContainerTrait¶
-
trait
atk4\core\ContainerTrait¶ - This trait makes it possible for you to add child objectsinto your object.
Source: vendor/atk4/core/src/ContainerTrait.php#9
Properties¶
-
public static property
atk4\core\ContainerTrait::$_containerTrait¶ - Check this property to see if trait is present in the object.
Source: vendor/atk4/core/src/ContainerTrait.php#16 Type: bool
-
public static property
atk4\core\ContainerTrait::$elements¶ - short_name => object hash of children objects. If the child is nottrackable, then object will be set to “true” (to avoid extra reference).
Source: vendor/atk4/core/src/ContainerTrait.php#24 Type: array
Methods¶
-
public
atk4\core\ContainerTrait::_unique_element($desired)¶ - Returns unique element name based on desired name.
Source: Parameters: - $desired (string)
Returns: string
-
public
atk4\core\ContainerTrait::add($obj, $args=[])¶ - If you are using ContainerTrait only, then you can safelyuse this add() method. If you are also using factory, orinitializer then redefine add() and call_add_Container, _add_Factory,.
Source: Parameters: - $obj (mixed)
- $args (array | string)
Throws: Returns: object
-
protected
atk4\core\ContainerTrait::_add_Container($element, $args=[])¶ - Extension to add() method which will perform linking ofthe object with the current class.
Source: Parameters: - $element (object)
- $args (array | string)
Throws: Returns: object
-
public
atk4\core\ContainerTrait::removeElement($short_name)¶ - Remove child element if it exists.
Source: Parameters: - $short_name (string) short name of the element
Throws: Returns: $this
-
protected
atk4\core\ContainerTrait::_shorten($desired)¶ - Method used internally for shortening object names.
Source: Parameters: - $desired (string) Desired name of new object.
Returns: string Shortened name of new object.
-
public
atk4\core\ContainerTrait::getElement($short_name)¶ - Find child element by its short name. Use in chaining.Exception if not found.
Source: Parameters: - $short_name (string) Short name of the child element
Throws: Returns: object
-
public
atk4\core\ContainerTrait::hasElement($short_name)¶ - Find child element. Use in condition.
Source: Parameters: - $short_name (string) Short name of the child element
Returns: object | bool