PHP Класс LeanMapper\Entity

Автор: Vojtěch Kohout
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$entityFactory leanmapper\IEntityFactory
$mapper leanmapper\IMapper
$reflections LeanMapper\Reflection\EntityReflection[]
$row Row

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

Метод Описание
__call ( string $name, array $arguments ) : mixed | void
__construct ( Row | Traversabl\Traversable | array | null $arg = null )
__get ( string $name ) : mixed
__isset ( string $name ) : boolean Tells whether given property exists and is not null
__set ( string $name, mixed $value )
__sleep ( ) : array
assign ( array | Traversabl\Traversable $values, array $whitelist = null ) Performs mass value assignment (using setters)
attach ( integer $id ) Attaches entity
detach ( ) Detaches entity
getData ( array $whitelist = null ) : array Gets high-level values of properties
getHasManyRowDifferences ( ) : array Gets current M:N differences
getModifiedRowData ( ) : array Gets low-level values of underlying Row columns that were modified
getReflection ( leanmapper\IMapper $mapper = null ) : EntityReflection Gets reflection of current entity
getRowData ( ) : array Gets low-level values of underlying Row columns
isDetached ( ) : boolean Tells whether entity is in detached state (like newly created entity)
isModified ( ) : boolean Tells whether entity was modified
makeAlive ( leanmapper\IEntityFactory $entityFactory = null, Connection $connection = null, leanmapper\IMapper $mapper = null ) Provides dependencies
markAsUpdated ( ) Marks entity as non-modified (isModified returns false right after this method call)

Защищенные методы

Метод Описание
assignEntityToProperty ( Entity $entity = null, Property | string $property )
createImplicitFilters ( string $entityClass, Caller $caller = null ) : ImplicitFilters
get ( $property, array $filterArgs = [] ) : mixed
getCurrentReflection ( ) : EntityReflection Gets current entity's reflection (cached in memory)
getValueByPropertyWithRelationship ( Property | string $property, Filtering $targetTableFiltering = null, Filtering $relationshipTableFiltering = null ) : Entity | Entity[]
initDefaults ( ) Allows initialize properties' default values
mergeFilters ( array $filters1, array $filters2 ) : array
set ( Property | string $property, mixed $value )

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

Метод Описание
addToOrRemoveFrom ( string $action, string $name, mixed $arg )
checkConsistency ( Property $property, string $mapperClass, Entity $entity )
checkMethodArgumentsCount ( integer $expectedCount, array $arguments, string $methodName )
getBelongsToManyValue ( Property $property, LeanMapper\Relationship\BelongsToMany $relationship, Filtering $filtering = null ) : Entity[]
getBelongsToOneValue ( Property $property, LeanMapper\Relationship\BelongsToOne $relationship, Filtering $filtering = null ) : Entity
getHasManyValue ( Property $property, HasMany $relationship, Filtering $targetTableFiltering = null, Filtering $relTableFiltering = null ) : Entity[]
getHasOneValue ( Property $property, HasOne $relationship, Filtering $filtering = null ) : Entity
setEntityFactory ( leanmapper\IEntityFactory $entityFactory )
useMapper ( leanmapper\IMapper $mapper ) Provides an mapper for entity

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

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

public __call ( string $name, array $arguments ) : mixed | void
$name string
$arguments array
Результат mixed | void

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

public __construct ( Row | Traversabl\Traversable | array | null $arg = null )
$arg Row | Traversabl\Traversable | array | null

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

public __get ( string $name ) : mixed
$name string
Результат mixed

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

Tells whether given property exists and is not null
public __isset ( string $name ) : boolean
$name string
Результат boolean

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

public __set ( string $name, mixed $value )
$name string
$value mixed

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

public __sleep ( ) : array
Результат array

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

Performs mass value assignment (using setters)
public assign ( array | Traversabl\Traversable $values, array $whitelist = null )
$values array | Traversabl\Traversable
$whitelist array

assignEntityToProperty() защищенный Метод

protected assignEntityToProperty ( Entity $entity = null, Property | string $property )
$entity Entity
$property LeanMapper\Reflection\Property | string micro-optimalization

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

Attaches entity
public attach ( integer $id )
$id integer

createImplicitFilters() защищенный Метод

protected createImplicitFilters ( string $entityClass, Caller $caller = null ) : ImplicitFilters
$entityClass string
$caller Caller
Результат ImplicitFilters

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

Detaches entity
public detach ( )

get() защищенный Метод

protected get ( $property, array $filterArgs = [] ) : mixed
$property
$filterArgs array
Результат mixed

getCurrentReflection() защищенный Метод

Gets current entity's reflection (cached in memory)
protected getCurrentReflection ( ) : EntityReflection
Результат LeanMapper\Reflection\EntityReflection

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

Gets high-level values of properties
public getData ( array $whitelist = null ) : array
$whitelist array
Результат array

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

Gets current M:N differences
public getHasManyRowDifferences ( ) : array
Результат array

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

Gets low-level values of underlying Row columns that were modified
public getModifiedRowData ( ) : array
Результат array

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

Gets reflection of current entity
public static getReflection ( leanmapper\IMapper $mapper = null ) : EntityReflection
$mapper leanmapper\IMapper
Результат LeanMapper\Reflection\EntityReflection

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

Gets low-level values of underlying Row columns
public getRowData ( ) : array
Результат array

getValueByPropertyWithRelationship() защищенный Метод

protected getValueByPropertyWithRelationship ( Property | string $property, Filtering $targetTableFiltering = null, Filtering $relationshipTableFiltering = null ) : Entity | Entity[]
$property LeanMapper\Reflection\Property | string micro-optimalization
$targetTableFiltering Filtering
$relationshipTableFiltering Filtering
Результат Entity | Entity[]

initDefaults() защищенный Метод

Allows initialize properties' default values
protected initDefaults ( )

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

Tells whether entity is in detached state (like newly created entity)
public isDetached ( ) : boolean
Результат boolean

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

Tells whether entity was modified
public isModified ( ) : boolean
Результат boolean

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

Provides dependencies
public makeAlive ( leanmapper\IEntityFactory $entityFactory = null, Connection $connection = null, leanmapper\IMapper $mapper = null )
$entityFactory leanmapper\IEntityFactory
$connection Connection
$mapper leanmapper\IMapper

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

Marks entity as non-modified (isModified returns false right after this method call)
public markAsUpdated ( )

mergeFilters() защищенный Метод

protected mergeFilters ( array $filters1, array $filters2 ) : array
$filters1 array
$filters2 array
Результат array

set() защищенный Метод

protected set ( Property | string $property, mixed $value )
$property LeanMapper\Reflection\Property | string
$value mixed

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

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

protected IEntityFactory,leanmapper $entityFactory
Результат leanmapper\IEntityFactory

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

protected IMapper,leanmapper $mapper
Результат leanmapper\IMapper

$reflections защищенное статическое свойство

protected static EntityReflection[],LeanMapper\Reflection $reflections
Результат LeanMapper\Reflection\EntityReflection[]

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

protected Row,leanmapper $row
Результат Row