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
Afficher le fichier Open project: phpthinktank/blast-orm

Méthodes publiques

Méthode 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

Méthode 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 méthode

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 méthode

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
Résultat Query

create() public méthode

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

createGateway() public méthode

Create a new Query instance
public createGateway ( $tableName ) : Gateway
Résultat Gateway

createQuery() public méthode

Create a new Query instance
public createQuery ( ) : Query
Résultat Query

delete() public méthode

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

find() public méthode

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

getDefinition() public méthode

public getDefinition ( ) : Blast\Orm\Entity\DefinitionInterface
Résultat Blast\Orm\Entity\DefinitionInterface

getProvider() public méthode

public getProvider ( ) : Blast\Orm\Entity\ProviderInterface
Résultat Blast\Orm\Entity\ProviderInterface

hasMany() public méthode

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
Résultat Query

hasOne() public méthode

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
Résultat Query

manyToMany() public méthode

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
Résultat Query

save() public méthode

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

select() public méthode

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

update() public méthode

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
Résultat Query