PHP Класс Scalr\Model\AbstractEntity

С версии: 4.5.0 (10.10.2013)
Автор: Vitaliy Demidov ([email protected])
Наследование: extends Scalr\Model\AbstractGetter, implements IteratorAggregat\IteratorAggregate
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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

Приватные методы

Метод Описание
_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

Описание методов

__call() публичный метод

public __call ( $method, $args )

__callStatic() публичный статический метод

public static __callStatic ( $name, $arguments )

__get() публичный метод

public __get ( $prop )

__set() публичный метод

public __set ( $prop, $value )

__unset() публичный метод

public __unset ( $prop )

_buildQuery() публичный метод

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
Результат array

db() публичный метод

Gets database instance associated with the entity
public db ( ) : ADODB_mysqli
Результат ADODB_mysqli Database connection instance

delete() публичный метод

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

fields() публичный метод

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
Результат string Returns comma separated list of the columns

getEntityAnnotation() публичный метод

Gets entity annotation for the class
public getEntityAnnotation ( ) : Scalr\Model\Loader\Entity
Результат Scalr\Model\Loader\Entity Returns entity annotation for the class

getIterator() публичный метод

См. также: IteratorAggregate::getIterator()
public getIterator ( ) : Scalr\Model\EntityPropertiesIterator
Результат Scalr\Model\EntityPropertiesIterator Gets EntityPropertiesIterator

load() публичный метод

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() публичный метод

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
Результат string Returns escaped value for the fiel

result() публичный статический метод

Instantiate an object and sets the type of the result
public static result ( integer $resultType ) : AbstractEntity
$resultType integer The type of the result
Результат AbstractEntity

save() публичный метод

Saves current entity to database
public save ( )

table() публичный метод

Gets table name which is associated with the entity
public table ( string $alias = null ) : string
$alias string optional The table alias
Результат string The name of the database table

type() публичный метод

Alias of the $entity->getIterator()->getField('name')->type;
public type ( string $field ) : Scalr\Model\Type\TypeInterface
$field string The name of the field
Результат Scalr\Model\Type\TypeInterface Returns field's type

update() публичный метод

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.