Properties

$id

$id : 

Type

$_updatedFields

$_updatedFields : 

Type

$_fieldTypes

$_fieldTypes : 

Type

Methods

fromParams()

fromParams(array  $params) : \OCP\AppFramework\Db\Entity

Simple alternative constructor for building entities from a request

Parameters

array $params

the array which was obtained via $this->params('key') in the controller

Returns

\OCP\AppFramework\Db\Entity

fromRow()

fromRow(array  $row) 

Maps the keys of the row array to the attributes

Parameters

array $row

the row to map onto the entity

getFieldTypes()

getFieldTypes() : array

Returns

array —

with attribute and type

resetUpdatedFields()

resetUpdatedFields() 

Marks the entity as clean needed for setting the id after the insertion

__call()

__call(  $methodName,   $args) 

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

Parameters

$methodName
$args

columnToProperty()

columnToProperty(string  $columnName) : string

Transform a database columnname to a property

Parameters

string $columnName

the name of the column

Returns

string —

the property name

propertyToColumn()

propertyToColumn(string  $property) : string

Transform a property to a database column name

Parameters

string $property

the name of the property

Returns

string —

the column name

getUpdatedFields()

getUpdatedFields() : array

Returns

array —

array of updated fields for update query

slugify()

slugify(string  $attributeName) : string

Slugify the value of a given attribute Warning: This doesn't result in a unique value

Parameters

string $attributeName

the name of the attribute, which value should be slugified

Returns

string —

slugified value

getId()

getId() : integer

Returns

integer

setId()

setId(integer  $id) : void

Parameters

integer $id

setter()

setter(  $name,   $args) 

Generic setter for properties

Parameters

$name
$args

getter()

getter(  $name) 

Generic getter for properties

Parameters

$name

markFieldUpdated()

markFieldUpdated(string  $attribute) 

Mark am attribute as updated

Parameters

string $attribute

the name of the attribute

addType()

addType(string  $fieldName, string  $type) 

Adds type information for a field so that its automatically casted to that value once its being returned from the database

Parameters

string $fieldName

the name of the attribute

string $type

the type which will be used to call settype()