PHP Класс LeanMapper\Repository

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

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

Свойство Тип Описание
$connection Connection
$entityClass string
$entityFactory leanmapper\IEntityFactory
$events Events
$mapper leanmapper\IMapper
$table string

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

Метод Описание
__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)

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

Метод Описание
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)

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

Метод Описание
getDocComment ( ) : string
getIdValue ( Entity $entity ) : mixed

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

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

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

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

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

checkEntityType() защищенный метод

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

createEntities() защищенный метод

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
Результат array

createEntity() защищенный метод

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
Результат mixed

createFluent() защищенный метод

protected createFluent ( ) : Fluent
Результат Fluent

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

Removes given entity (or entity with given id) from database
public delete ( mixed $arg ) : mixed
$arg mixed
Результат mixed

deleteFromDatabase() защищенный метод

Performs database delete (can be customized)
protected deleteFromDatabase ( mixed $arg ) : mixed
$arg mixed
Результат mixed

getTable() защищенный метод

Gets name of (main) database table related to entity that repository can handle
protected getTable ( ) : string
Результат string

initEvents() защищенный метод

Allows initialize repository's events
protected initEvents ( )

insertIntoDatabase() защищенный метод

Performs database insert (can be customized)
protected insertIntoDatabase ( Entity $entity ) : mixed
$entity Entity
Результат mixed

persist() публичный метод

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
Результат mixed

persistHasManyChanges() защищенный метод

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

updateInDatabase() защищенный метод

Performs database update (can be customized)
protected updateInDatabase ( Entity $entity ) : mixed
$entity Entity
Результат mixed

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

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

protected Connection,leanmapper $connection
Результат Connection

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

protected string $entityClass
Результат string

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

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

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

protected Events,leanmapper $events
Результат Events

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

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

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

protected string $table
Результат string