PHP Class LeanMapper\Repository

Author: Vojtěch Kohout
Afficher le fichier Open project: tharos/leanmapper Class Usage Examples

Protected Properties

Свойство Type Description
$connection Connection
$entityClass string
$entityFactory leanmapper\IEntityFactory
$events Events
$mapper leanmapper\IMapper
$table string

Méthodes publiques

Méthode Description
__construct ( Connection $connection, leanmapper\IMapper $mapper, leanmapper\IEntityFactory $entityFactory )
__get ( string $name ) : array | null
delete ( mixed $arg ) : mixed Removes given entity (or entity with given id) from database
persist ( Entity $entity ) : mixed Stores values of entity's modified properties into database (inserts new row when entity is in detached state)

Méthodes protégées

Méthode Description
checkEntityType ( Entity $entity ) Checks whether give entity is instance of required type
createEntities ( array $rows, string | null $entityClass = null, string | null $table = null ) : array Creates new set of Entity's instances from given array of \Dibi\Row instances
createEntity ( Row $dibiRow, string | null $entityClass = null, string | null $table = null ) : mixed Creates new Entity instance from given \Dibi\Row instance
createFluent ( ) : Fluent
deleteFromDatabase ( mixed $arg ) : mixed Performs database delete (can be customized)
getTable ( ) : string Gets name of (main) database table related to entity that repository can handle
initEvents ( ) Allows initialize repository's events
insertIntoDatabase ( Entity $entity ) : mixed Performs database insert (can be customized)
persistHasManyChanges ( Entity $entity ) Persists changes in M:N relationships
updateInDatabase ( Entity $entity ) : mixed Performs database update (can be customized)

Private Methods

Méthode Description
getDocComment ( ) : string
getIdValue ( Entity $entity ) : mixed

Method Details

__construct() public méthode

public __construct ( Connection $connection, leanmapper\IMapper $mapper, leanmapper\IEntityFactory $entityFactory )
$connection Connection
$mapper leanmapper\IMapper
$entityFactory leanmapper\IEntityFactory

__get() public méthode

public __get ( string $name ) : array | null
$name string
Résultat array | null

checkEntityType() protected méthode

Checks whether give entity is instance of required type
protected checkEntityType ( Entity $entity )
$entity Entity

createEntities() protected méthode

Creates new set of Entity's instances from given array of \Dibi\Row instances
protected createEntities ( array $rows, string | null $entityClass = null, string | null $table = null ) : array
$rows array
$entityClass string | null
$table string | null
Résultat array

createEntity() protected méthode

Creates new Entity instance from given \Dibi\Row instance
protected createEntity ( Row $dibiRow, string | null $entityClass = null, string | null $table = null ) : mixed
$dibiRow Dibi\Row
$entityClass string | null
$table string | null
Résultat mixed

createFluent() protected méthode

protected createFluent ( ) : Fluent
Résultat Fluent

delete() public méthode

Removes given entity (or entity with given id) from database
public delete ( mixed $arg ) : mixed
$arg mixed
Résultat mixed

deleteFromDatabase() protected méthode

Performs database delete (can be customized)
protected deleteFromDatabase ( mixed $arg ) : mixed
$arg mixed
Résultat mixed

getTable() protected méthode

Gets name of (main) database table related to entity that repository can handle
protected getTable ( ) : string
Résultat string

initEvents() protected méthode

Allows initialize repository's events
protected initEvents ( )

insertIntoDatabase() protected méthode

Performs database insert (can be customized)
protected insertIntoDatabase ( Entity $entity ) : mixed
$entity Entity
Résultat mixed

persist() public méthode

Stores values of entity's modified properties into database (inserts new row when entity is in detached state)
public persist ( Entity $entity ) : mixed
$entity Entity
Résultat mixed

persistHasManyChanges() protected méthode

Persists changes in M:N relationships
protected persistHasManyChanges ( Entity $entity )
$entity Entity

updateInDatabase() protected méthode

Performs database update (can be customized)
protected updateInDatabase ( Entity $entity ) : mixed
$entity Entity
Résultat mixed

Property Details

$connection protected_oe property

protected Connection,leanmapper $connection
Résultat Connection

$entityClass protected_oe property

protected string $entityClass
Résultat string

$entityFactory protected_oe property

protected IEntityFactory,leanmapper $entityFactory
Résultat leanmapper\IEntityFactory

$events protected_oe property

protected Events,leanmapper $events
Résultat Events

$mapper protected_oe property

protected IMapper,leanmapper $mapper
Résultat leanmapper\IMapper

$table protected_oe property

protected string $table
Résultat string