PHP 클래스 Webiny\Component\Entity\AbstractEntity

상속: implements ArrayAccess, use trait Webiny\Component\StdLib\StdLibTrait, use trait EntityTrait, use trait Webiny\Component\StdLib\FactoryLoaderTrait
파일 보기 프로젝트 열기: Webiny/Framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$attributeBuilder EntityAttributeBuilder
$attributes Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject Entity attributes
$entityCollection Entity collection name
$entityMask string View mask (used for grids and many2one input fields)

공개 메소드들

메소드 설명
__call ( $name, $arguments )
__construct ( ) Entity constructor
__get ( $name ) : AbstractAttribute This method allows us to use simplified accessor methods.
__set ( $name, $value ) This method allows setting attribute values through simple assignment Ex: $person->name = 'Webiny';
__toString ( ) : mixed Return string representation of entity
attr ( $attribute ) : EntityAttributeBuilder
count ( array $conditions = [] ) : integer Count records using given criteria
delete ( ) : boolean Delete entity
exists ( ) : boolean Is this entity already saved?
find ( array $conditions = [], array $order = [], integer $limit, integer $page ) : EntityCollection Find entities
findById ( $id ) : null | AbstractEntity Find entity by ID
findOne ( array $conditions = [] ) : null | AbstractEntity Find entity by array of conditions
getAttribute ( string $attribute ) : AbstractAttribute Get entity attribute
getAttributes ( ) : ArrayObject Get all entity attributes
getEntityCollection ( ) : string Get collection name
getMaskedValue ( )
latest ( integer $limit = 1 ) : mixed | null Finds one or more latest entities
offsetExists ( $offset )
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
populate ( array $data ) Populate entity with given data
random ( array $conditions = [] ) : null | AbstractEntity Find a random entity
save ( ) Save entity attributes to database
toArray ( string $fields = '' ) : array Convert AbstractEntity to array with specified fields.

보호된 메소드들

메소드 설명
isDbData ( $data ) : boolean Used for checking if the entity populate data is coming from database

비공개 메소드들

메소드 설명
normalizeData ( $data )
parseOrderParameters ( $order ) : array Parse order parameters and construct parameters suitable for MongoDB
populateAttribute ( $attributeName, AbstractAttribute $entityAttribute, $validation, $data, $fromDb )

메소드 상세

__call() 공개 메소드

public __call ( $name, $arguments )

__construct() 공개 메소드

Entity constructor
public __construct ( )

__get() 공개 메소드

Ex: $person->company->name
public __get ( $name ) : AbstractAttribute
$name
리턴 Webiny\Component\Entity\Attribute\AbstractAttribute

__set() 공개 메소드

This method allows setting attribute values through simple assignment Ex: $person->name = 'Webiny';
public __set ( $name, $value )
$name
$value

__toString() 공개 메소드

Return string representation of entity
public __toString ( ) : mixed
리턴 mixed

attr() 공개 메소드

public attr ( $attribute ) : EntityAttributeBuilder
$attribute
리턴 EntityAttributeBuilder

count() 공개 정적인 메소드

Count records using given criteria
public static count ( array $conditions = [] ) : integer
$conditions array
리턴 integer

delete() 공개 메소드

Delete entity
public delete ( ) : boolean
리턴 boolean

exists() 공개 메소드

Is this entity already saved?
public exists ( ) : boolean
리턴 boolean

find() 공개 정적인 메소드

Find entities
public static find ( array $conditions = [], array $order = [], integer $limit, integer $page ) : EntityCollection
$conditions array
$order array Example: ['-name', '+title']
$limit integer
$page integer
리턴 EntityCollection

findById() 공개 정적인 메소드

Find entity by ID
public static findById ( $id ) : null | AbstractEntity
$id
리턴 null | AbstractEntity

findOne() 공개 정적인 메소드

Find entity by array of conditions
public static findOne ( array $conditions = [] ) : null | AbstractEntity
$conditions array
리턴 null | AbstractEntity

getAttribute() 공개 메소드

Get entity attribute
public getAttribute ( string $attribute ) : AbstractAttribute
$attribute string
리턴 Webiny\Component\Entity\Attribute\AbstractAttribute

getAttributes() 공개 메소드

Get all entity attributes
public getAttributes ( ) : ArrayObject
리턴 Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject

getEntityCollection() 공개 정적인 메소드

Get collection name
public static getEntityCollection ( ) : string
리턴 string

getMaskedValue() 공개 메소드

public getMaskedValue ( )

isDbData() 보호된 메소드

Used for checking if the entity populate data is coming from database
protected isDbData ( $data ) : boolean
$data
리턴 boolean

latest() 공개 정적인 메소드

Finds one or more latest entities
public static latest ( integer $limit = 1 ) : mixed | null
$limit integer
리턴 mixed | null

offsetExists() 공개 메소드

public offsetExists ( $offset )

offsetGet() 공개 메소드

public offsetGet ( $offset )

offsetSet() 공개 메소드

public offsetSet ( $offset, $value )

offsetUnset() 공개 메소드

public offsetUnset ( $offset )

populate() 공개 메소드

Populate entity with given data
public populate ( array $data )
$data array

random() 공개 정적인 메소드

Find a random entity
public static random ( array $conditions = [] ) : null | AbstractEntity
$conditions array
리턴 null | AbstractEntity

save() 공개 메소드

Save entity attributes to database
public save ( )

toArray() 공개 메소드

If no fields are specified, array will contain all simple and Many2One attributes
public toArray ( string $fields = '' ) : array
$fields string List of fields to extract
리턴 array

프로퍼티 상세

$attributeBuilder 보호되어 있는 프로퍼티

protected EntityAttributeBuilder,Webiny\Component\Entity $attributeBuilder
리턴 EntityAttributeBuilder

$attributes 보호되어 있는 프로퍼티

Entity attributes
protected ArrayObject,Webiny\Component\StdLib\StdObject\ArrayObject $attributes
리턴 Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject

$entityCollection 보호되어 있는 정적으로 프로퍼티

Entity collection name
protected static $entityCollection

$entityMask 보호되어 있는 정적으로 프로퍼티

View mask (used for grids and many2one input fields)
protected static string $entityMask
리턴 string