PHP 클래스 CRUDlex\MySQLData

상속: extends AbstractData
파일 보기 프로젝트 열기: philiplb/crudlex

보호된 프로퍼티들

프로퍼티 타입 설명
$database Holds the Doctrine DBAL instance.
$useUUIDs Flag whether to use UUIDs as primary key.

공개 메소드들

메소드 설명
__construct ( EntityDefinition $definition, crudlex\FileProcessorInterface $fileProcessor, $database, boolean $useUUIDs ) Constructor.
countBy ( $table, array $params, array $paramsOperators, $excludeDeleted )
create ( Entity $entity )
fetchReferences ( array &$entities = null )
get ( $id )
getIdToNameMap ( $entity, $nameField )
hasManySet ( $field, array $thatIds, $excludeId = null )
listEntries ( array $filter = [], array $filterOperators = [], $skip = null, $amount = null, $sortField = null, $sortAscending = null )
update ( Entity $entity )

보호된 메소드들

메소드 설명
addFilter ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, array $filter, array $filterOperators ) Adds sorting parameters to the query.
addPagination ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, integer | null $skip, integer | null $amount ) Adds pagination parameters to the query.
addSort ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, string | null $sortField, boolean | null $sortAscending ) Adds sorting parameters to the query.
deleteChildren ( integer $id, boolean $deleteCascade ) Performs the cascading children deletion.
doDelete ( Entity $entity, $deleteCascade )
enrichWithMany ( array $rows ) : array Fetches to the rows belonging many-to-many entries and adds them to the rows.
enrichWithManyField ( array &$idToData, $manyField ) Enriches the given mapping of entity id to raw entity data with some many-to-many data.
fetchReferencesForField ( array &$entities, string $field ) Adds the id and name of referenced entities to the given entities. The reference field is before the raw id of the referenced entity and after the fetch, it's an array with the keys id and name.
generateUUID ( ) : string | null Generates a new UUID.
getFormFields ( ) : array Gets all form fields including the many-to-many-ones.
getManyFields ( ) : array | string[] Gets the many-to-many fields.
getManyIds ( array $fields, array $params ) : array Gets all possible many-to-many ids existing for this definition.
hasChildren ( integer $id ) : boolean Checks whether the by id given entity still has children referencing it.
saveMany ( Entity $entity ) First, deletes all to the given entity related many-to-many entries from the DB and then writes them again.
setValuesAndParameters ( Entity $entity, Doctrine\DBAL\Query\QueryBuilder $queryBuilder, string $setMethod ) Sets the values and parameters of the upcoming given query according to the entity.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( EntityDefinition $definition, crudlex\FileProcessorInterface $fileProcessor, $database, boolean $useUUIDs )
$definition EntityDefinition the entity definition
$fileProcessor crudlex\FileProcessorInterface the file processor to use
$database the Doctrine DBAL instance to use
$useUUIDs boolean flag whether to use UUIDs as primary key

addFilter() 보호된 메소드

Adds sorting parameters to the query.
protected addFilter ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, array $filter, array $filterOperators )
$queryBuilder Doctrine\DBAL\Query\QueryBuilder the query
$filter array the filter all resulting entities must fulfill, the keys as field names
$filterOperators array the operators of the filter like "=" defining the full condition of the field

addPagination() 보호된 메소드

Adds pagination parameters to the query.
protected addPagination ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, integer | null $skip, integer | null $amount )
$queryBuilder Doctrine\DBAL\Query\QueryBuilder the query
$skip integer | null the rows to skip
$amount integer | null the maximum amount of rows

addSort() 보호된 메소드

Adds sorting parameters to the query.
protected addSort ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, string | null $sortField, boolean | null $sortAscending )
$queryBuilder Doctrine\DBAL\Query\QueryBuilder the query
$sortField string | null the sort field
$sortAscending boolean | null true if sort ascending, false if descending

countBy() 공개 메소드

public countBy ( $table, array $params, array $paramsOperators, $excludeDeleted )
$params array
$paramsOperators array

create() 공개 메소드

public create ( Entity $entity )
$entity Entity

deleteChildren() 보호된 메소드

Performs the cascading children deletion.
protected deleteChildren ( integer $id, boolean $deleteCascade )
$id integer the current entities id
$deleteCascade boolean whether to delete children and sub children

doDelete() 보호된 메소드

protected doDelete ( Entity $entity, $deleteCascade )
$entity Entity

enrichWithMany() 보호된 메소드

Fetches to the rows belonging many-to-many entries and adds them to the rows.
protected enrichWithMany ( array $rows ) : array
$rows array the rows to enrich
리턴 array the enriched rows

enrichWithManyField() 보호된 메소드

Enriches the given mapping of entity id to raw entity data with some many-to-many data.
protected enrichWithManyField ( array &$idToData, $manyField )
$idToData array a reference to the map entity id to raw entity data
$manyField the many field to enrich data with

fetchReferences() 공개 메소드

public fetchReferences ( array &$entities = null )
$entities array

fetchReferencesForField() 보호된 메소드

Adds the id and name of referenced entities to the given entities. The reference field is before the raw id of the referenced entity and after the fetch, it's an array with the keys id and name.
protected fetchReferencesForField ( array &$entities, string $field )
$entities array
$field string the reference field

generateUUID() 보호된 메소드

Generates a new UUID.
protected generateUUID ( ) : string | null
리턴 string | null the new UUID or null if this instance isn't configured to do so

get() 공개 메소드

public get ( $id )

getFormFields() 보호된 메소드

Gets all form fields including the many-to-many-ones.
protected getFormFields ( ) : array
리턴 array all form fields

getIdToNameMap() 공개 메소드

public getIdToNameMap ( $entity, $nameField )

getManyFields() 보호된 메소드

Gets the many-to-many fields.
protected getManyFields ( ) : array | string[]
리턴 array | string[] the many-to-many fields

getManyIds() 보호된 메소드

Gets all possible many-to-many ids existing for this definition.
protected getManyIds ( array $fields, array $params ) : array
$fields array the many field names to fetch for
$params array the parameters the possible many field values to fetch for
리턴 array an array of this many-to-many ids

hasChildren() 보호된 메소드

Checks whether the by id given entity still has children referencing it.
protected hasChildren ( integer $id ) : boolean
$id integer the current entities id
리턴 boolean true if the entity still has children

hasManySet() 공개 메소드

public hasManySet ( $field, array $thatIds, $excludeId = null )
$thatIds array

listEntries() 공개 메소드

public listEntries ( array $filter = [], array $filterOperators = [], $skip = null, $amount = null, $sortField = null, $sortAscending = null )
$filter array
$filterOperators array

saveMany() 보호된 메소드

First, deletes all to the given entity related many-to-many entries from the DB and then writes them again.
protected saveMany ( Entity $entity )
$entity Entity the entity to save the many-to-many entries of

setValuesAndParameters() 보호된 메소드

Sets the values and parameters of the upcoming given query according to the entity.
protected setValuesAndParameters ( Entity $entity, Doctrine\DBAL\Query\QueryBuilder $queryBuilder, string $setMethod )
$entity Entity the entity with its fields and values
$queryBuilder Doctrine\DBAL\Query\QueryBuilder the upcoming query
$setMethod string what method to use on the QueryBuilder: 'setValue' or 'set'

update() 공개 메소드

public update ( Entity $entity )
$entity Entity

프로퍼티 상세

$database 보호되어 있는 프로퍼티

Holds the Doctrine DBAL instance.
protected $database

$useUUIDs 보호되어 있는 프로퍼티

Flag whether to use UUIDs as primary key.
protected $useUUIDs