PHP Class Blast\Orm\Mapper

Inheritance: 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
ファイルを表示 Open project: phpthinktank/blast-orm

Public Methods

Method Description
__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

Private Methods

Method Description
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

Method Details

__construct() public method

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() public method

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
return Query

create() public method

Create query for new entity.
public create ( array | ArrayObject | stdClass | object $entity ) : Query | boolean
$entity array | ArrayObject | stdClass | object
return Query | boolean

createGateway() public method

Create a new Query instance
public createGateway ( $tableName ) : Gateway
return Gateway

createQuery() public method

Create a new Query instance
public createQuery ( ) : Query
return Query

delete() public method

Prepare delete query for attached entity by identifiers
public delete ( integer | string $identifier ) : query
$identifier integer | string
return query

find() public method

Select query for finding entity by primary key
public find ( mixed $primaryKey ) : Query
$primaryKey mixed
return Query

getDefinition() public method

public getDefinition ( ) : Blast\Orm\Entity\DefinitionInterface
return Blast\Orm\Entity\DefinitionInterface

getProvider() public method

public getProvider ( ) : Blast\Orm\Entity\ProviderInterface
return Blast\Orm\Entity\ProviderInterface

hasMany() public method

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
return Query

hasOne() public method

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
return Query

manyToMany() public method

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
return Query

save() public method

Create or update an entity
public save ( ArrayObject | SplStack | stdClass | object $entity ) : Query
$entity ArrayObject | SplStack | stdClass | object
return Query

select() public method

Select query for entity
public select ( array $selects = ['*'] ) : Query
$selects array
return Query

update() public method

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
return Query