Entity

class OCP\AppFramework\Db\Entity
Source:lib/public/AppFramework/Db/Entity.php#36

Properties

public static property OCP\AppFramework\Db\Entity::$id
Source:lib/public/AppFramework/Db/Entity.php#37

Methods

public static OCP\AppFramework\Db\Entity::fromParams($params)
Simple alternative constructor for building entities from a request
Source:

lib/public/AppFramework/Db/Entity.php#50

Parameters:
  • $params (array) the array which was obtained via $this->params(‘key’)

in the controller

Returns:

\OCP\AppFramework\Db\Entity

Since:

7.0.0

public static OCP\AppFramework\Db\Entity::fromRow($row)
Maps the keys of the row array to the attributes
Source:

lib/public/AppFramework/Db/Entity.php#67

Parameters:
  • $row (array) the row to map onto the entity
Since:

7.0.0

public OCP\AppFramework\Db\Entity::getFieldTypes()
Source:lib/public/AppFramework/Db/Entity.php#86
Returns:array with attribute and type
Since:7.0.0
public OCP\AppFramework\Db\Entity::resetUpdatedFields()
Marks the entity as clean needed for setting the id after the insertion
Source:lib/public/AppFramework/Db/Entity.php#95
Since:7.0.0
protected OCP\AppFramework\Db\Entity::setter($name, $args)
Generic setter for properties
Source:lib/public/AppFramework/Db/Entity.php#103
Since:7.0.0
protected OCP\AppFramework\Db\Entity::getter($name)
Generic getter for properties
Source:lib/public/AppFramework/Db/Entity.php#138
Since:7.0.0
public OCP\AppFramework\Db\Entity::__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
Source:lib/public/AppFramework/Db/Entity.php#156
Since:7.0.0
protected OCP\AppFramework\Db\Entity::isGetterForBoolProperty($methodName)
Source:

lib/public/AppFramework/Db/Entity.php#174

Parameters:
  • $methodName (string)
Returns:

bool

Since:

18.0.0

protected OCP\AppFramework\Db\Entity::markFieldUpdated($attribute)
Mark am attribute as updated
Source:

lib/public/AppFramework/Db/Entity.php#187

Parameters:
  • $attribute (string) the name of the attribute
Since:

7.0.0

public OCP\AppFramework\Db\Entity::columnToProperty($columnName)
Transform a database columnname to a property
Source:

lib/public/AppFramework/Db/Entity.php#198

Parameters:
  • $columnName (string) the name of the column
Returns:

string the property name

Since:

7.0.0

public OCP\AppFramework\Db\Entity::propertyToColumn($property)
Transform a property to a database column name
Source:

lib/public/AppFramework/Db/Entity.php#220

Parameters:
  • $property (string) the name of the property
Returns:

string the column name

Since:

7.0.0

public OCP\AppFramework\Db\Entity::getUpdatedFields()
Source:lib/public/AppFramework/Db/Entity.php#240
Returns:array array of updated fields for update query
Since:7.0.0
protected OCP\AppFramework\Db\Entity::addType($fieldName, $type)
Adds type information for a field so that its automatically casted to
that value once its being returned from the database
Source:

lib/public/AppFramework/Db/Entity.php#252

Parameters:
  • $fieldName (string) the name of the attribute
  • $type (string) the type which will be used to call settype()
Since:

7.0.0

public OCP\AppFramework\Db\Entity::slugify($attributeName)
Slugify the value of a given attribute
Warning: This doesn’t result in a unique value
Source:

lib/public/AppFramework/Db/Entity.php#264

Parameters:
  • $attributeName (string) the name of the attribute, which value should be slugified
Returns:

string slugified value

Since:

7.0.0