Entity
Tags
Table of Contents
- $id : mixed
 - $_fieldTypes : mixed
 - $_updatedFields : mixed
 - __call() : mixed
 - Each time a setter is called, push the part after set into an array: for instance setId will save Id in the updated fields array so it can be easily used to create the getter method
 - columnToProperty() : string
 - Transform a database columnname to a property
 - fromParams() : Entity
 - Simple alternative constructor for building entities from a request
 - fromRow() : mixed
 - Maps the keys of the row array to the attributes
 - getFieldTypes() : array
 - getId() : int
 - getUpdatedFields() : array
 - propertyToColumn() : string
 - Transform a property to a database column name
 - resetUpdatedFields() : mixed
 - Marks the entity as clean needed for setting the id after the insertion
 - setId() : void
 - slugify() : string
 - Slugify the value of a given attribute Warning: This doesn't result in a unique value
 - addType() : mixed
 - Adds type information for a field so that its automatically casted to that value once its being returned from the database
 - getter() : mixed
 - Generic getter for properties
 - isGetterForBoolProperty() : bool
 - markFieldUpdated() : mixed
 - Mark am attribute as updated
 - setter() : mixed
 - Generic setter for properties
 
Properties
$id
    public
        mixed
    $id
    
    
    
$_fieldTypes
    private
        mixed
    $_fieldTypes
     = array('id' => 'integer')
    
    
$_updatedFields
    private
        mixed
    $_updatedFields
     = array()
    
    
Methods
__call()
Each time a setter is called, push the part after set into an array: for instance setId will save Id in the updated fields array so it can be easily used to create the getter method
    public
                __call(mixed $methodName, mixed $args) : mixed
    
        Parameters
- $methodName : mixed
 - $args : mixed
 
Tags
Return values
mixed —columnToProperty()
Transform a database columnname to a property
    public
                columnToProperty(string $columnName) : string
    
        Parameters
- $columnName : string
 - 
                    
the name of the column
 
Tags
Return values
string —the property name
fromParams()
Simple alternative constructor for building entities from a request
    public
            static    fromParams(array $params) : Entity
    
        Parameters
- $params : array
 - 
                    
the array which was obtained via $this->params('key') in the controller
 
Tags
Return values
Entity —fromRow()
Maps the keys of the row array to the attributes
    public
            static    fromRow(array $row) : mixed
    
        Parameters
- $row : array
 - 
                    
the row to map onto the entity
 
Tags
Return values
mixed —getFieldTypes()
    public
                getFieldTypes() : array
    
    
    
    Tags
Return values
array —with attribute and type
getId()
    public
                getId() : int
    
    
    
        Return values
int —getUpdatedFields()
    public
                getUpdatedFields() : array
    
    
    
    Tags
Return values
array —array of updated fields for update query
propertyToColumn()
Transform a property to a database column name
    public
                propertyToColumn(string $property) : string
    
        Parameters
- $property : string
 - 
                    
the name of the property
 
Tags
Return values
string —the column name
resetUpdatedFields()
Marks the entity as clean needed for setting the id after the insertion
    public
                resetUpdatedFields() : mixed
    
    
    
    Tags
Return values
mixed —setId()
    public
                setId(int $id) : void
    
        Parameters
- $id : int
 
slugify()
Slugify the value of a given attribute Warning: This doesn't result in a unique value
    public
                slugify(string $attributeName) : string
    
        Parameters
- $attributeName : string
 - 
                    
the name of the attribute, which value should be slugified
 
Tags
Return values
string —slugified value
addType()
Adds type information for a field so that its automatically casted to that value once its being returned from the database
    protected
                addType(string $fieldName, string $type) : mixed
    
        Parameters
- $fieldName : string
 - 
                    
the name of the attribute
 - $type : string
 - 
                    
the type which will be used to call settype()
 
Tags
Return values
mixed —getter()
Generic getter for properties
    protected
                getter(mixed $name) : mixed
    
        Parameters
- $name : mixed
 
Tags
Return values
mixed —isGetterForBoolProperty()
    protected
                isGetterForBoolProperty(string $methodName) : bool
    
        Parameters
- $methodName : string
 
Tags
Return values
bool —markFieldUpdated()
Mark am attribute as updated
    protected
                markFieldUpdated(string $attribute) : mixed
    
        Parameters
- $attribute : string
 - 
                    
the name of the attribute
 
Tags
Return values
mixed —setter()
Generic setter for properties
    protected
                setter(mixed $name, mixed $args) : mixed
    
        Parameters
- $name : mixed
 - $args : mixed