PHP Класс Scalr\Api\DataType\ApiEntityAdapter

С версии: 5.4.0 (02.03.2015)
Автор: Vitaliy Demidov ([email protected])
Наследование: extends Scalr\Model\Objects\BaseAdapter
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$controller Scalr\Api\Rest\Controller\ApiController Controller instance

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

Метод Описание
__construct ( ApiController $controller ) Constructor
convertInputValue ( $fieldType, $value, $fieldName = '' )
convertOutputValue ( string $fieldType, string $value ) : mixed Converts output value
copyAlterableProperties ( object $object, AbstractEntity $entity ) Copies all alterable properties from the request object to Entity
find ( array $criteria = null, callable $findCallback = null ) : ApiEntityAdapter Fetches records according to rules set
getCriteria ( array $criteria = null ) : array | null Adjusts search criteria according to RULE_TYPE_FILTERABLE rules and Request
getDescribeResult ( array $criteria = null, callable $findCallback = null ) : Scalr\Api\DataType\ListResultEnvelope Gets describe result
getSettingsCollection ( AbstractEntity $entity ) : SettingsCollection Gets settings collection from entity.
getSettingsRules ( ) : array Gets settings to data rules
getSorting ( ) : array | null Gets sorting option for the find method of the Entity
toData ( $entity )
toEntity ( $data )
validateEntity ( AbstractEntity $entity ) Validates entity
validateObject ( object $object, string $method = null ) Validates object
validateString ( string $string, string $message = 'Invalid string' ) Validates specified string

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

__construct() публичный Метод

Constructor
public __construct ( ApiController $controller )
$controller Scalr\Api\Rest\Controller\ApiController The controller instance

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

См. также: BaseAdapter::convertInputValue()
public static convertInputValue ( $fieldType, $value, $fieldName = '' )

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

Converts output value
public static convertOutputValue ( string $fieldType, string $value ) : mixed
$fieldType string Field type
$value string A value taken from input
Результат mixed Returns value which can be used in the response

copyAlterableProperties() публичный Метод

It does not validate the values. It only checks whether the request contains only alterable properties. If not it will raise ApiErrorExceptions
public copyAlterableProperties ( object $object, AbstractEntity $entity )
$object object An object (source)
$entity Scalr\Model\AbstractEntity An Entity (destination)

find() публичный Метод

Fetches records according to rules set
public find ( array $criteria = null, callable $findCallback = null ) : ApiEntityAdapter
$criteria array optional Default search criteria
$findCallback callable optional Find method. Default value: find
Результат ApiEntityAdapter Returns current instance that actually is iterator of the found records

getCriteria() публичный Метод

Adjusts search criteria according to RULE_TYPE_FILTERABLE rules and Request
public getCriteria ( array $criteria = null ) : array | null
$criteria array optional Default search criteria
Результат array | null Returns adjusted criteria

getDescribeResult() публичный Метод

Gets describe result
public getDescribeResult ( array $criteria = null, callable $findCallback = null ) : Scalr\Api\DataType\ListResultEnvelope
$criteria array Default search criteria
$findCallback callable optional Find method. Default value: find
Результат Scalr\Api\DataType\ListResultEnvelope Returns describe result

getSettingsCollection() публичный Метод

Gets settings collection from entity.
public getSettingsCollection ( AbstractEntity $entity ) : SettingsCollection
$entity Scalr\Model\AbstractEntity Entity containing collection of settings
Результат Scalr\Model\Collections\SettingsCollection

getSettingsRules() публичный Метод

Gets settings to data rules
public getSettingsRules ( ) : array
Результат array

getSorting() публичный Метод

It processes HTTP Request and takes RULE_TYPE_SORTING of rules into account
public getSorting ( ) : array | null
Результат array | null Returns sorting option for the find method of the Entity

toData() публичный Метод

См. также: BaseAdapter::toData()
public toData ( $entity )

toEntity() публичный Метод

См. также: BaseAdapter::toEntity()
public toEntity ( $data )

validateEntity() публичный Метод

It is applicable only to either POST or PATCH methods. It should be used on GET methods.
public validateEntity ( AbstractEntity $entity )
$entity Scalr\Model\AbstractEntity An Entity

validateObject() публичный Метод

It is applicable only to either POST or PATCH methods. It should be used on GET methods.
public validateObject ( object $object, string $method = null )
$object object An object provided with the request
$method string optional HTTP METHOD

validateString() публичный Метод

Validates specified string
public validateString ( string $string, string $message = 'Invalid string' )
$string string A string
$message string optional A error message

Описание свойств

$controller защищенное свойство

Controller instance
protected ApiController,Scalr\Api\Rest\Controller $controller
Результат Scalr\Api\Rest\Controller\ApiController