Property | Type | Description | |
---|---|---|---|
$database | Holds the Doctrine DBAL instance. | ||
$useUUIDs | Flag whether to use UUIDs as primary key. |
Method | Description | |
---|---|---|
__construct ( |
Constructor. | |
countBy ( $table, array $params, array $paramsOperators, $excludeDeleted ) | ||
create ( |
||
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 ( |
Method | Description | |
---|---|---|
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 ( |
||
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 ( |
First, deletes all to the given entity related many-to-many entries from the DB and then writes them again. | |
setValuesAndParameters ( |
Sets the values and parameters of the upcoming given query according to the entity. |
public __construct ( |
||
$definition | 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 |
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 |
protected deleteChildren ( integer $id, boolean $deleteCascade ) | ||
$id | integer | the current entities id |
$deleteCascade | boolean | whether to delete children and sub children |
protected enrichWithMany ( array $rows ) : array | ||
$rows | array | the rows to enrich |
return | array | the enriched rows |
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 |
protected fetchReferencesForField ( array &$entities, string $field ) | ||
$entities | array | |
$field | string | the reference field |
protected generateUUID ( ) : string | null | ||
return | string | null | the new UUID or null if this instance isn't configured to do so |
protected getFormFields ( ) : array | ||
return | array | all form fields |
protected getManyFields ( ) : array | string[] | ||
return | array | string[] | the many-to-many fields |
protected hasChildren ( integer $id ) : boolean | ||
$id | integer | the current entities id |
return | boolean | true if the entity still has children |
public hasManySet ( $field, array $thatIds, $excludeId = null ) | ||
$thatIds | array |
public listEntries ( array $filter = [], array $filterOperators = [], $skip = null, $amount = null, $sortField = null, $sortAscending = null ) | ||
$filter | array | |
$filterOperators | array |
protected saveMany ( |
||
$entity | the entity to save the many-to-many entries of |
protected setValuesAndParameters ( |
||
$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' |