Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
__construct ($properties=[]) | |
__get ($property) | |
__isset ($property) | |
__set ($property, $value) | |
__unset ($property) | |
bind ($properties, $updateNulls=true) | |
dump ($depth=3, \SplObjectStorage $dumped=null) | |
getIterator () | |
jsonSerialize () | |
count () | |
Fonctions membres protégées | |
dumpProperty ($property, $depth, \SplObjectStorage $dumped) | |
getProperty ($property) | |
setProperty ($property, $value) | |
Attributs privés | |
$properties = [] | |
DataObject is a class that is used to store data but allowing you to access the data by mimicking the way PHP handles class properties.
__construct | ( | $properties = [] | ) |
The class constructor.
mixed | $properties | Either an associative array or another object by which to set the initial properties of the new object. |
Références DataObject\$properties, et DataObject\bind().
__get | ( | $property | ) |
The magic get method is used to get a data property.
This method is a public proxy for the protected getProperty method.
Note: Magic __get does not allow recursive calls. This can be tricky because the error generated by recursing into __get is "Undefined property: {CLASS}::{PROPERTY}" which is misleading. This is relevant for this class because requesting a non-visible property can trigger a call to a sub-function. If that references the property directly in the object, it will cause a recursion into __get.
string | $property | The name of the data property. |
Références DataObject\getProperty().
__isset | ( | $property | ) |
The magic isset method is used to check the state of an object property.
string | $property | The name of the data property. |
__set | ( | $property, | |
$value | |||
) |
The magic set method is used to set a data property.
This is a public proxy for the protected setProperty method.
string | $property | The name of the data property. |
mixed | $value | The value to give the data property. |
Références $value, et DataObject\setProperty().
__unset | ( | $property | ) |
The magic unset method is used to unset a data property.
string | $property | The name of the data property. |
bind | ( | $properties, | |
$updateNulls = true |
|||
) |
Binds an array or object to this object.
mixed | $properties | An associative array of properties or an object. |
boolean | $updateNulls | True to bind null values, false to ignore null values. |
Références DataObject\$properties, $this, $value, elseif, null, et DataObject\setProperty().
Référencé par DataObject\__construct().
count | ( | ) |
Count the number of data properties.
dump | ( | $depth = 3 , |
|
\SplObjectStorage | $dumped = null |
||
) |
Dumps the data properties into an object, recursively if appropriate.
integer | $depth | The maximum depth of recursion (default = 3). For example, a depth of 0 will return a stdClass with all the properties in native form. A depth of 1 will recurse into the first level of properties only. |
\SplObjectStorage | $dumped | An array of already serialized objects that is used to avoid infinite loops. |
Implémente DumpableInterface.
Références $this, DataObject\dumpProperty(), et null.
Référencé par DataObject\getIterator(), et DataObject\jsonSerialize().
|
protected |
Dumps a data property.
If recursion is set, this method will dump any object implementing DumpableInterface (like DataObject and DataSet); it will convert a DateTimeInterface object to a string; and it will convert a Joomla to an object.
string | $property | The name of the data property. |
integer | $depth | The current depth of recursion (a value of 0 will ignore recursion). |
\SplObjectStorage | $dumped | An array of already serialized objects that is used to avoid infinite loops. |
Références $value, elseif, et DataObject\getProperty().
Référencé par DataObject\dump().
getIterator | ( | ) |
Gets this object represented as an ArrayIterator.
This allows the data properties to be access via a foreach statement.
Références DataObject\dump().
|
protected |
Gets a data property.
string | $property | The name of the data property. |
Références null.
Référencé par DataObject\__get(), et DataObject\dumpProperty().
jsonSerialize | ( | ) |
Gets the data properties in a form that can be serialised to JSON format.
Références DataObject\dump().
|
protected |
Sets a data property.
If the name of the property starts with a null byte, this method will return null.
string | $property | The name of the data property. |
mixed | $value | The value to give the data property. |
Références $value.
Référencé par DataObject\__set(), et DataObject\bind().
|
private |
Référencé par DataObject\__construct(), et DataObject\bind().