| Fully Qualified Name: | CodeIgniter\Entity |
| Implements: | JsonSerializable |
Entity encapsulation, for use with CodeIgniter\Model
| Name | Description | Defined By |
|---|---|---|
| __construct() | Allows filling in Entity parameters during construction. | Entity |
| __get() | Magic method to allow retrieval of protected and private class properties either by their name, or through a `getCamelCasedProperty()` method. | Entity |
| __isset() | Returns true if a property exists names $key, or a getter method exists named like for __get(). | Entity |
| __set() | Magic method to all protected/private class properties to be easily set, either through a direct access or a `setCamelCasedProperty()` method. | Entity |
| __unset() | Unsets an attribute property. | Entity |
| fill() | Takes an array of key/value pairs and sets them as class properties, using any `setCamelCasedProperty()` methods that may or may not exist. | Entity |
| hasChanged() | Checks a property to see if it has changed since the entity was created. | Entity |
| jsonSerialize() | Support for json_encode() | Entity |
| setAttributes() | Set raw data array without any mutations | Entity |
| syncOriginal() | Ensures our "original" values match the current values. | Entity |
| toArray() | General method that will return all public and protected values of this entity as an array. All values are accessed through the __get() magic method so will have any casts, etc applied to them. | Entity |
| toRawArray() | Returns the raw values of the current attributes. | Entity |
Allows filling in Entity parameters during construction.
| Parameter Name | Type | Description |
|---|---|---|
| $data | array|null |
Returns:
Magic method to allow retrieval of protected and private class properties either by their name, or through a `getCamelCasedProperty()` method.
Examples:
$p = $this->my_property $p = $this->getMyProperty()
| Parameter Name | Type | Description |
|---|---|---|
| $key | string |
Returns: mixed
Returns true if a property exists names $key, or a getter method exists named like for __get().
| Parameter Name | Type | Description |
|---|---|---|
| $key | string |
Returns: bool
Magic method to all protected/private class properties to be easily set, either through a direct access or a `setCamelCasedProperty()` method.
Examples:
$this->my_property = $p; $this->setMyProperty() = $p;
| Parameter Name | Type | Description |
|---|---|---|
| $key | string | |
| $value | null |
Returns: $this
Unsets an attribute property.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string |
Returns:
Takes an array of key/value pairs and sets them as class properties, using any `setCamelCasedProperty()` methods that may or may not exist.
| Parameter Name | Type | Description |
|---|---|---|
| $data | array |
Returns: \CodeIgniter\Entity
Checks a property to see if it has changed since the entity was created.
Or, without a parameter, checks if any properties have changed.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string |
Returns: bool
Support for json_encode()
Returns: array|mixed
Set raw data array without any mutations
| Parameter Name | Type | Description |
|---|---|---|
| $data | array |
Returns: $this
Ensures our "original" values match the current values.
Returns: $this
General method that will return all public and protected values of this entity as an array. All values are accessed through the __get() magic method so will have any casts, etc applied to them.
| Parameter Name | Type | Description |
|---|---|---|
| $onlyChanged | bool | If |
| $cast | bool | If |
Returns: array
Returns the raw values of the current attributes.
| Parameter Name | Type | Description |
|---|---|---|
| $onlyChanged | bool |
Returns: array