Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe DataObject
+ Graphe d'héritage de DataObject:

Fonctions membres publiques

 __construct ($properties=array())
 
 __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 = array()
 

Description détaillée

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.

Depuis
1.0

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $properties = array())

The class constructor.

Paramètres
mixed$propertiesEither an associative array or another object by which to set the initial properties of the new object.
Depuis
1.0
Exceptions

Références DataObject\$properties, et DataObject\bind().

Documentation des fonctions membres

◆ __get()

__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.

Paramètres
string$propertyThe name of the data property.
Renvoie
mixed The value of the data property, or null if the data property does not exist.
Voir également
DataObject::getProperty()
Depuis
1.0

Références DataObject\getProperty().

◆ __isset()

__isset (   $property)

The magic isset method is used to check the state of an object property.

Paramètres
string$propertyThe name of the data property.
Renvoie
boolean True if set, otherwise false is returned.
Depuis
1.0

◆ __set()

__set (   $property,
  $value 
)

The magic set method is used to set a data property.

This is a public proxy for the protected setProperty method.

Paramètres
string$propertyThe name of the data property.
mixed$valueThe value to give the data property.
Renvoie
void
Voir également
DataObject::setProperty()
Depuis
1.0

Références $value, et DataObject\setProperty().

◆ __unset()

__unset (   $property)

The magic unset method is used to unset a data property.

Paramètres
string$propertyThe name of the data property.
Renvoie
void
Depuis
1.0

◆ bind()

bind (   $properties,
  $updateNulls = true 
)

Binds an array or object to this object.

Paramètres
mixed$propertiesAn associative array of properties or an object.
boolean$updateNullsTrue to bind null values, false to ignore null values.
Renvoie
DataObject Returns itself to allow chaining.
Depuis
1.0
Exceptions

Références DataObject\$properties, $value, elseif, null, et DataObject\setProperty().

Référencé par DataObject\__construct().

◆ count()

count ( )

Count the number of data properties.

Renvoie
integer The number of data properties.
Depuis
1.0

◆ dump()

dump (   $depth = 3,
\SplObjectStorage  $dumped = null 
)

Dumps the data properties into a stdClass object, recursively if appropriate.

Paramètres
integer$depthThe 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$dumpedAn array of already serialized objects that is used to avoid infinite loops.
Renvoie
The data properties as a simple PHP stdClass object.
Depuis
1.0

Implémente DumpableInterface.

Références DataObject\dumpProperty(), et null.

Référencé par DataObject\getIterator(), et DataObject\jsonSerialize().

◆ dumpProperty()

dumpProperty (   $property,
  $depth,
\SplObjectStorage  $dumped 
)
protected

Dumps a data property.

If recursion is set, this method will dump any object implementing Data (like Data and Data); it will convert a Date object to a string; and it will convert a Registry to an object.

Paramètres
string$propertyThe name of the data property.
integer$depthThe current depth of recursion (a value of 0 will ignore recursion).
\SplObjectStorage$dumpedAn array of already serialized objects that is used to avoid infinite loops.
Renvoie
mixed The value of the dumped property.
Depuis
1.0

Références $value, elseif, et DataObject\getProperty().

Référencé par DataObject\dump().

◆ getIterator()

getIterator ( )

Gets this object represented as an ArrayIterator.

This allows the data properties to be access via a foreach statement.

Renvoie
This object represented as an ArrayIterator.
Voir également
IteratorAggregate::getIterator()
Depuis
1.0

Références DataObject\dump().

◆ getProperty()

getProperty (   $property)
protected

Gets a data property.

Paramètres
string$propertyThe name of the data property.
Renvoie
mixed The value of the data property.
Voir également
DataObject::__get()
Depuis
1.0

Références $value, et null.

Référencé par DataObject\__get(), et DataObject\dumpProperty().

◆ jsonSerialize()

jsonSerialize ( )

Gets the data properties in a form that can be serialised to JSON format.

Renvoie
string An object that can be serialised by json_encode().
Depuis
1.0

Implémente JsonSerializable.

Références DataObject\dump().

◆ setProperty()

setProperty (   $property,
  $value 
)
protected

Sets a data property.

If the name of the property starts with a null byte, this method will return null.

Paramètres
string$propertyThe name of the data property.
mixed$valueThe value to give the data property.
Renvoie
mixed The value of the data property.
Voir également
DataObject::__set()
Depuis
1.0

Références $value, et null.

Référencé par DataObject\__set(), et DataObject\bind().

Documentation des champs

◆ $properties

$properties = array()
private

La documentation de cette classe a été générée à partir du fichier suivant :