PHP Класс Blast\Orm\Mapper

Наследование: implements Blast\Orm\Entity\EntityAwareInterface, implements Blast\Orm\ConnectionAwareInterface, implements Blast\Orm\MapperInterface, implements Blast\Orm\Entity\ProviderFactoryInterface, use trait ConnectionAwareTrait, use trait Blast\Orm\Entity\EntityAwareTrait, use trait Blast\Orm\Entity\ProviderFactoryTrait
Показать файл Открыть проект

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

Метод Описание
__construct ( array | ArrayObject | stdClas\stdClass | object | string $entity, Doctrine\DBAL\Driver\Connection $connection = null ) Disable direct access to mapper
belongsTo ( $entity, $foreignEntity, null $localKey = null ) : Query BelongsTo is the inverse of a HasOne or a HasMany relation.
create ( array | ArrayObject | stdClass | object $entity ) : Query | boolean Create query for new entity.
createGateway ( $tableName ) : Gateway Create a new Query instance
createQuery ( ) : Query Create a new Query instance
delete ( integer | string $identifier ) : query Prepare delete query for attached entity by identifiers
find ( mixed $primaryKey ) : Query Select query for finding entity by primary key
getDefinition ( ) : Blast\Orm\Entity\DefinitionInterface
getProvider ( ) : Blast\Orm\Entity\ProviderInterface
hasMany ( $entity, $foreignEntity, null $foreignKey = null ) : Query One entity is associated with many related entities by a field which associates with primary key in current entity.
hasOne ( $entity, $foreignEntity, null | string $foreignKey = null ) : Query One entity is associated with one related entity by a field which associates with primary key in current entity.
manyToMany ( $entity, $foreignEntity, null $foreignKey = null, null $localKey = null, null $junction = null, null $junctionLocalKey = null, null $junctionForeignKey = null ) : Query Many entities of type _A_ are associated with many related entities of type _B_ by a junction table.
save ( ArrayObject | SplStack | stdClass | object $entity ) : Query Create or update an entity
select ( array $selects = ['*'] ) : Query Select query for entity
update ( array | ArrayObject | stdClass | object $entity ) : Query Update query for existing Model or a collection of entities in storage

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

Метод Описание
checkEntity ( $entity ) Check if external entity matches mapper entity
prepareProvider ( $entity ) : Provider Prepare provider by determining entity type
prepareRelation ( Blast\Orm\Relations\RelationInterface $relation ) : mixed Share mapper connection with relation

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

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

Disable direct access to mapper
public __construct ( array | ArrayObject | stdClas\stdClass | object | string $entity, Doctrine\DBAL\Driver\Connection $connection = null )
$entity array | ArrayObject | stdClas\stdClass | object | string
$connection Doctrine\DBAL\Driver\Connection

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

One entity is associated with one related entity by a field which associates with primary key in related entity.
public belongsTo ( $entity, $foreignEntity, null $localKey = null ) : Query
$entity
$foreignEntity
$localKey null
Результат Query

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

Create query for new entity.
public create ( array | ArrayObject | stdClass | object $entity ) : Query | boolean
$entity array | ArrayObject | stdClass | object
Результат Query | boolean

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

Create a new Query instance
public createGateway ( $tableName ) : Gateway
Результат Gateway

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

Create a new Query instance
public createQuery ( ) : Query
Результат Query

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

Prepare delete query for attached entity by identifiers
public delete ( integer | string $identifier ) : query
$identifier integer | string
Результат query

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

Select query for finding entity by primary key
public find ( mixed $primaryKey ) : Query
$primaryKey mixed
Результат Query

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

public getDefinition ( ) : Blast\Orm\Entity\DefinitionInterface
Результат Blast\Orm\Entity\DefinitionInterface

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

public getProvider ( ) : Blast\Orm\Entity\ProviderInterface
Результат Blast\Orm\Entity\ProviderInterface

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

One entity is associated with many related entities by a field which associates with primary key in current entity.
public hasMany ( $entity, $foreignEntity, null $foreignKey = null ) : Query
$entity
$foreignEntity
$foreignKey null
Результат Query

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

One entity is associated with one related entity by a field which associates with primary key in current entity.
public hasOne ( $entity, $foreignEntity, null | string $foreignKey = null ) : Query
$entity
$foreignEntity
$foreignKey null | string
Результат Query

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

The junction table stores associations from entities of type _A_ to entities of type _B_.
public manyToMany ( $entity, $foreignEntity, null $foreignKey = null, null $localKey = null, null $junction = null, null $junctionLocalKey = null, null $junctionForeignKey = null ) : Query
$entity
$foreignEntity
$foreignKey null
$localKey null
$junction null
$junctionLocalKey null
$junctionForeignKey null
Результат Query

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

Create or update an entity
public save ( ArrayObject | SplStack | stdClass | object $entity ) : Query
$entity ArrayObject | SplStack | stdClass | object
Результат Query

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

Select query for entity
public select ( array $selects = ['*'] ) : Query
$selects array
Результат Query

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

Update query for existing Model or a collection of entities in storage
public update ( array | ArrayObject | stdClass | object $entity ) : Query
$entity array | ArrayObject | stdClass | object
Результат Query