# Class CRUDMySQLData

MySQL CRUDData implementation using a given Doctrine DBAL instance.

  CRUDlex\CRUDData
  CRUDlex\CRUDMySQLData

Namespace: CRUDlex
Located at CRUDMySQLData.php

Methods summary
`protected boolean` | # `doDelete( string $id, boolean $deleteCascade )` Performs the actual deletion. Performs the actual deletion. #### Parameters $id the id of the entry to delete $deleteCascade whether to delete children and subchildren #### Returns boolean true on successful deletion
`public` | # `__construct( `CRUDlex\CRUDEntityDefinition` $definition, `CRUDlex\CRUDFileProcessorInterface` $fileProcessor, $db )` Constructor. Constructor. #### Parameters $definition the entity definition $fileProcessor the file processor to use $db Doctrine DBAL instance to use
`public `CRUDlex\CRUDEntity`` | # `get( string $id )` Gets the entity with the given id. Gets the entity with the given id. #### Parameters $id the id #### Returns `CRUDlex\CRUDEntity` the entity belonging to the id or null if not existant
`public array` | # `listEntries( array $filter = array(), array $filterOperators = array(), integer $skip = null, integer $amount = null )` 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 $filterOperators the operators of the filter like "=" defining the full condition of the field $skip if given and not null, it specifies the amount of rows to skip $amount if given and not null, it specifies the maximum amount of rows to retrieve #### 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 boolean` | # `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 #### Returns boolean true on successful deletion
`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 $excludeDeleted )` 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 $paramOperators the operators of the parameters like "=" defining the full condition of the field $excludeDeleted false, if soft deleted entries in the datasource should be counted, too #### Returns integer the count fulfilling the given parameters
`public` | # `fetchReferences( array & $entities = null )` 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. 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. #### Parameters $entities the entities to fetch the references for

Methods inherited from CRUDlex\CRUDData
`createEmpty(), createFiles(), deleteFile(), deleteFiles(), getDefinition(), hydrate(), renderFile(), updateFiles()`

Properties summary
`protected` | $db Holds the Doctrine DBAL instance. Holds the Doctrine DBAL instance. | # ``

Properties inherited from CRUDlex\CRUDData
`$definition, $fileProcessor`