Class CRUDMySQLData
MySQL CRUDData implementation using a given Doctrine DBAL instance.
-
CRUDlex\CRUDData
-
CRUDlex\CRUDMySQLData
Methods summary
public
|
|
public
CRUDlex\CRUDEntity
|
#
get( string $id )
Gets the entity with the given id.
Gets the entity with the given id.
Parameters
Returns
|
public
array
|
#
listEntries( array $filter = array() )
Gets a list of entities fullfilling the given filter or all if no
selection was given.
Gets a list of entities fullfilling the given filter or all if no
selection was given.
Parameters
- $filter
- the filter all resulting entities must fulfill, the keys as field names
Returns
array the entities fulfilling the filter or all if no filter was given
|
public
|
#
create( CRUDlex\CRUDEntity $entity )
Persists the given entity as new entry in the datasource.
Persists the given entity as new entry in the datasource.
Parameters
- $entity
- the entity to persist.
|
public
|
#
update( CRUDlex\CRUDEntity $entity )
Updates an existing entry in the datasource having the same id.
Updates an existing entry in the datasource having the same id.
Parameters
- $entity
- the entity with the new data
|
public
|
#
delete( string $id )
Deletes an entry from the datasource having the given id.
Deletes an entry from the datasource having the given id.
Parameters
- $id
- the id of the entry to delete
|
public
array
|
#
getReferences( string $table, string $nameField )
Gets ids and names of a table. Used for building up the dropdown box of
reference type fields.
Gets ids and names of a table. Used for building up the dropdown box of
reference type fields.
Parameters
- $table
- the table
- $nameField
- the field defining the name of the rows
Returns
array an array with the ids as key and the names as values
|
public
integer
|
#
countBy( string $table, array $params, array $paramsOperators, boolean $includeDeleted )
Retrieves the amount of entities in the datasource fulfilling the given
parameters.
Retrieves the amount of entities in the datasource fulfilling the given
parameters.
Parameters
- $table
- the table to count in
- $params
- an array with the field names as keys and field values as values
- $paramsOperators
- <p>$paramOperators
the operators of the parameters like "=" defining the full condition of the field</p>
- $includeDeleted
- true, if soft deleted entries in the datasource should be counted, too
Returns
integer the count fulfilling the given parameters
|
public
|
#
fetchReferences( CRUDlex\CRUDEntity $entity = null )
Adds the id and name of referenced entities to the given entity. 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.
Adds the id and name of referenced entities to the given entity. 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.
Parameters
- $entity
- the entity to fetch the references for
|
Properties summary
protected
mixed
|
$db
Holds the Doctrine DBAL instance.
Holds the Doctrine DBAL instance.
|
|