PHP Class Scalr\Model\AbstractEntity

Since: 4.5.0 (10.10.2013)
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Model\AbstractGetter, implements IteratorAggregat\IteratorAggregate
Afficher le fichier Open project: scalr/scalr Class Usage Examples

Méthodes publiques

Méthode Description
__call ( $method, $args )
__callStatic ( $name, $arguments )
__get ( $prop )
__set ( $prop, $value )
__unset ( $prop )
_buildQuery ( array $criteria, string $conjunction = 'AND', string $tableAlias = null ) : array Builds query statement
db ( ) : ADODB_mysqli Gets database instance associated with the entity
delete ( ) Removes current record from database by primary key
fields ( string $tableAlias = null, boolean $prefixed = false ) : string Gets comma separated list of the columns prefixed either with the table name or the specified table alias
getEntityAnnotation ( ) : Scalr\Model\Loader\Entity Gets entity annotation for the class
getIterator ( ) : Scalr\Model\EntityPropertiesIterator
load ( array | object $obj, string $tableAlias = null ) Loads an entity from array or object
qstr ( string | Scalr\Model\Loader\Field $field, mixed $value = null ) : string Escapes value for the field
result ( integer $resultType ) : AbstractEntity Instantiate an object and sets the type of the result
save ( ) Saves current entity to database
table ( string $alias = null ) : string Gets table name which is associated with the entity
type ( string $field ) : Scalr\Model\Type\TypeInterface Gets the type for the specified field
update ( array | Iterato\Iterator $fieldValues ) Updates only specified properties to database ingoring all others

Private Methods

Méthode Description
_column ( string $fieldName, string $tableAlias = null, string $alias = null ) : string Gets column name for the specified field
_delete ( array $criteria = null, integer $limit = null ) : integer Removes records from database by criteria
_deletePk ( array $args = [] ) : integer Removes record from database by primary key
_fetchIndexes ( ) Retrieves show indexes info and stores it in the cache
_find ( array $criteria = null, array $group = null, array $order = null, integer $limit = null, integer $offset = null, boolean $countRecords = null ) : ArrayCollection | EntityIterator | ADORecordSet_mysql\ADORecordSet_mysqli Finds collection of the values by any key
_findOne ( array $criteria = null, array $group = null, array $order = null ) : AbstractEntity | null Finds one record by given criteria
_findPk ( array $args = [] ) : AbstractEntity | null Finds record by primary key
_hasUniqueIndex ( ) : boolean Checks whether the table has at least one unique index
_parseClassDocComment ( ) Parses phpdoc comment for entity class
_prepareSaveStatement ( ) : Scalr\Model\EntityStatement Prepares statement to store data in database

Method Details

__call() public méthode

public __call ( $method, $args )

__callStatic() public static méthode

public static __callStatic ( $name, $arguments )

__get() public méthode

public __get ( $prop )

__set() public méthode

public __set ( $prop, $value )

__unset() public méthode

public __unset ( $prop )

_buildQuery() public méthode

Builds query statement
public _buildQuery ( array $criteria, string $conjunction = 'AND', string $tableAlias = null ) : array
$criteria array Criteria array
$conjunction string optional Conjucntion
$tableAlias string optional Table alias
Résultat array

db() public méthode

Gets database instance associated with the entity
public db ( ) : ADODB_mysqli
Résultat ADODB_mysqli Database connection instance

delete() public méthode

Removes current record from database by primary key
public delete ( )

fields() public méthode

Gets comma separated list of the columns prefixed either with the table name or the specified table alias
public fields ( string $tableAlias = null, boolean $prefixed = false ) : string
$tableAlias string optional An table alias
$prefixed boolean optional Should the column names be provided with alias prefixed by the tableAlias
Résultat string Returns comma separated list of the columns

getEntityAnnotation() public méthode

Gets entity annotation for the class
public getEntityAnnotation ( ) : Scalr\Model\Loader\Entity
Résultat Scalr\Model\Loader\Entity Returns entity annotation for the class

getIterator() public méthode

See also: IteratorAggregate::getIterator()
public getIterator ( ) : Scalr\Model\EntityPropertiesIterator
Résultat Scalr\Model\EntityPropertiesIterator Gets EntityPropertiesIterator

load() public méthode

Loads an entity from array or object
public load ( array | object $obj, string $tableAlias = null )
$obj array | object Source data
$tableAlias string optional The table alias which should be threated as column name prefix

qstr() public méthode

Escapes value for the field
public qstr ( string | Scalr\Model\Loader\Field $field, mixed $value = null ) : string
$field string | Scalr\Model\Loader\Field The name of the field or the Field object
$value mixed optional The value to escape or it will take field's value from the object
Résultat string Returns escaped value for the fiel

result() public static méthode

Instantiate an object and sets the type of the result
public static result ( integer $resultType ) : AbstractEntity
$resultType integer The type of the result
Résultat AbstractEntity

save() public méthode

Saves current entity to database
public save ( )

table() public méthode

Gets table name which is associated with the entity
public table ( string $alias = null ) : string
$alias string optional The table alias
Résultat string The name of the database table

type() public méthode

Alias of the $entity->getIterator()->getField('name')->type;
public type ( string $field ) : Scalr\Model\Type\TypeInterface
$field string The name of the field
Résultat Scalr\Model\Type\TypeInterface Returns field's type

update() public méthode

It also stores field's values in the object itself.
public update ( array | Iterato\Iterator $fieldValues )
$fieldValues array | Iterato\Iterator The list of the fields with its values looks like [fieldName1 => $value1, filedName2 ...] If it is provided with the field name in the value place with numerical index it will update the record with the value taken from the entity itself.