Свойство | Тип | Описание | |
---|---|---|---|
$definition | Holds the {@see EntityDefinition} entity definition. | ||
$events | Holds the events. | ||
$fileProcessor | Holds the {@see FileProcessorInterface} file processor. |
Метод | Описание | |
---|---|---|
countBy ( string $table, array $params, array $paramsOperators, boolean $excludeDeleted ) : integer | Retrieves the amount of entities in the datasource fulfilling the given parameters. | |
create ( |
Persists the given entity as new entry in the datasource. | |
createEmpty ( ) : |
Creates a new, empty entity instance having all fields prefilled with null or the defined value in case of fixed fields. | |
createFiles ( |
Creates the uploaded files of a newly created entity. | |
delete ( |
Deletes an entry from the datasource. | |
deleteFile ( |
Deletes a specific file from an existing entity. | |
deleteFiles ( |
Deletes all files of an existing entity. | |
fetchReferences ( array &$entities = null ) : void | Adds the id and name of referenced entities to the given entities. Each 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. | |
get ( string $id ) : void | Gets the entity with the given id. | |
getDefinition ( ) : |
Gets the {@see EntityDefinition} instance. | |
getIdToNameMap ( string $entity, string $nameField ) : array | Gets ids and names of a table. Used for building up the dropdown box of reference type fields for example. | |
hasManySet ( string $field, array $thatIds, string | null $excludeId = null ) : boolean | Checks whether a given set of ids is assigned to any entity exactly like it is given (no subset, no superset). | |
listEntries ( array $filter = [], array $filterOperators = [], integer | null $skip = null, integer | null $amount = null, string | null $sortField = null, boolean | null $sortAscending = null ) : |
Gets a list of entities fullfilling the given filter or all if no selection was given. | |
popEvent ( string $moment, string $action ) : Closure | null | Removes and returns the latest event for the given parameters. | |
pushEvent ( string $moment, string $action, Closure $function ) | Adds an event to fire for the given parameters. The event function must have this signature: function (Entity $entity) and has to return true or false. | |
renderFile ( |
Renders (outputs) a file of an entity. This includes setting headers like the file size, mimetype and name, too. | |
update ( |
Updates an existing entry in the datasource having the same id. | |
updateFiles ( |
Updates the uploaded files of an updated entity. |
Метод | Описание | |
---|---|---|
doDelete ( |
Performs the actual deletion. | |
enrichEntityWithMetaData ( mixed $id, |
Enriches an entity with metadata: id, version, created_at, updated_at | |
hydrate ( array $row ) : |
Creates an {@see Entity} from the raw data array with the field name as keys and field values as values. | |
performOnFiles ( |
Executes a function for each file field of this entity. | |
shouldExecuteEvents ( |
Executes the event chain of an entity. |
abstract public countBy ( string $table, array $params, array $paramsOperators, boolean $excludeDeleted ) : integer | ||
$table | string | the table to count in |
$params | array | an array with the field names as keys and field values as values |
$paramsOperators | array | the operators of the parameters like "=" defining the full condition of the field |
$excludeDeleted | boolean | false, if soft deleted entries in the datasource should be counted, too |
Результат | integer | the count fulfilling the given parameters |
public createEmpty ( ) : |
||
Результат | the newly created entity |
public createFiles ( |
||
$request | the HTTP request containing the file data | |
$entity | the just created entity | |
$entityName | string | the name of the entity as this class here is not aware of it |
Результат | boolean | true if all before events passed |
public delete ( |
||
$entity | the entity to delete | |
Результат | integer | returns one of: - AbstractData::DELETION_SUCCESS -> successful deletion - AbstractData::DELETION_FAILED_STILL_REFERENCED -> failed deletion due to existing references - AbstractData::DELETION_FAILED_EVENT -> failed deletion due to a failed before delete event |
public deleteFile ( |
||
$entity | the entity to delete the file from | |
$entityName | string | the name of the entity as this class here is not aware of it |
$field | string | the field of the entity containing the file to be deleted |
Результат | boolean | true on successful deletion |
public deleteFiles ( |
||
$entity | the entity to delete the files from | |
$entityName | string | the name of the entity as this class here is not aware of it |
Результат | boolean | true on successful deletion |
protected enrichEntityWithMetaData ( mixed $id, |
||
$id | mixed | the id of the entity to enrich |
$entity | the entity to enrich |
abstract public fetchReferences ( array &$entities = null ) : void | ||
$entities | array | |
Результат | void |
public getDefinition ( ) : |
||
Результат | the definition instance |
abstract public hasManySet ( string $field, array $thatIds, string | null $excludeId = null ) : boolean | ||
$field | string | the many field |
$thatIds | array | the id set to check |
$excludeId | string | null | one optional own id to exclude from the check |
Результат | boolean | true if the set of ids exists for an entity |
abstract public listEntries ( array $filter = [], array $filterOperators = [], integer | null $skip = null, integer | null $amount = null, string | null $sortField = null, boolean | null $sortAscending = null ) : |
||
$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 |
$skip | integer | null | if given and not null, it specifies the amount of rows to skip |
$amount | integer | null | if given and not null, it specifies the maximum amount of rows to retrieve |
$sortField | string | null | if given and not null, it specifies the field to sort the entries |
$sortAscending | boolean | null | if given and not null, it specifies that the sort order is ascending, descending else |
Результат | the entities fulfilling the filter or all if no filter was given |
protected performOnFiles ( |
||
$entity | the just created entity | |
$entityName | string | the name of the entity as this class here is not aware of it |
$function | Closure | the function to perform, takes $entity, $entityName and $field as parameter |
public popEvent ( string $moment, string $action ) : Closure | null | ||
$moment | string | the "moment" of the event, can be either "before" or "after" |
$action | string | the "action" of the event, can be either "create", "update" or "delete" |
Результат | Closure | null | the popped event or null if no event was available. |
public renderFile ( |
||
$entity | the entity to render the file from | |
$entityName | string | the name of the entity as this class here is not aware of it |
$field | string | the field of the entity containing the file to be rendered |
Результат | the HTTP response, likely to be a streamed one |
protected shouldExecuteEvents ( |
||
$entity | the entity having the event chain to execute | |
$moment | string | the "moment" of the event, can be either "before" or "after" |
$action | string | the "action" of the event, can be either "create", "update" or "delete" |
Результат | boolean | true on successful execution of the full chain or false if it broke at any point (and stopped the execution) |
public updateFiles ( |
||
$request | the HTTP request containing the file data | |
$entity | the updated entity | |
$entityName | string | the name of the entity as this class here is not aware of it |
Результат | boolean | true on successful update |
protected $definition |