File: docs/source/api/atk4/core/DIContainerTrait.rst

Recommend this page to a friend!
  Classes of Francesco Danti  >  ATK4 i18next PHP  >  docs/source/api/atk4/core/DIContainerTrait.rst  >  Download  
File: docs/source/api/atk4/core/DIContainerTrait.rst
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: ATK4 i18next PHP
Translate application texts like il8next-PHP
Author: By
Last change:
Date: 0 years ago
Size: 2,754 bytes


Class file image Download
.. rst-class:: phpdoctorst

.. role:: php(code)
	:language: php


.. php:namespace:: atk4\core

.. php:trait:: DIContainerTrait

	.. rst-class:: phpdoc-description
		| A class with this trait will have setDefaults\(\) method that can
		| be passed list of default properties\.
		| $view\-\>setDefaults\(\[\'ui\' =\> \'segment\'\]\);
		| Typically you would want to do that inside your constructor\. The
		| default handling of the properties is:
		|  \- only apply properties that are defined
		|  \- only set property if it\'s current value is null
		|  \- ignore defaults that have null value
		|  \- if existing property and default have array, then both arrays will be merged
		| Several classes may opt to extend setDefaults, for example in Agile UI
		| setDefaults is extended to support classes and content:
		| $segment\-\>setDefaults\(\[\'Hello There\', \'red\', \'ui\'=\>\'segment\'\]\);
		| WARNING: Do not use this trait unless you have a lot of properties
		| to inject\. Also follow the guidelines on
		| https://github\.com/atk4/ui/wiki/Object\-Constructors
		| Relying on this trait excessively may cause anger management issues to
		| some code reviewers\.
		`vendor/atk4/core/src/DIContainerTrait.php#31 <>`_


.. php:attr:: public static _DIContainerTrait

	.. rst-class:: phpdoc-description
		| Check this property to see if trait is present in the object\.
		`vendor/atk4/core/src/DIContainerTrait.php#38 <>`_
	:Type: bool 


.. rst-class:: public

	.. php:method:: public setDefaults( $properties=\[\], $passively=false)
		.. rst-class:: phpdoc-description
			| Call from \_\_construct\(\) to initialize the properties allowing
			| developer to pass Dependency Injector Container\.
			`vendor/atk4/core/src/DIContainerTrait.php#47 <>`_
			* **$properties** (array)  
			* **$passively** (bool)  if true, existing non-null argument values will be kept


.. rst-class:: protected

	.. php:method:: protected setMissingProperty( $key, $value)
		.. rst-class:: phpdoc-description
			| Sets object property\.
			| Throws exception\.
			`vendor/atk4/core/src/DIContainerTrait.php#76 <>`_
			* **$key** (mixed)  
			* **$value** (mixed)  


For more information send a message to info at phpclasses dot org.