Class Mapper
Definition at line 11 of file Mapper.php.
◆ __construct()
| __construct |
( |
|
$config = [] | ) |
|
Initialize dependencies.
- Parameters
-
Definition at line 23 of file Mapper.php.
26 $this->config = $config;
◆ databaseToEntity()
| databaseToEntity |
( |
|
$entityType, |
|
|
|
$data |
|
) |
| |
{Map database field name to entity field name
- Parameters
-
| string | $entityType | |
| array | $data | |
- Returns
- array
- Exceptions
-
}
Implements MapperInterface.
Definition at line 51 of file Mapper.php.
54 foreach ($this->config[
$entityType] as $databaseFieldName => $entityFieldName) {
55 if (!$entityFieldName) {
56 throw new \LogicException(
'Incorrect configuration for ' .
$entityType);
58 if (isset(
$data[$databaseFieldName])) {
59 $data[$entityFieldName] =
$data[$databaseFieldName];
60 unset(
$data[$databaseFieldName]);
◆ entityToDatabase()
| entityToDatabase |
( |
|
$entityType, |
|
|
|
$data |
|
) |
| |
{Map entity field name to database field name
- Parameters
-
| string | $entityType | |
| array | $data | |
- Returns
- array
- Exceptions
-
}
Implements MapperInterface.
Definition at line 32 of file Mapper.php.
35 foreach ($this->config[
$entityType] as $databaseFieldName => $entityFieldName) {
36 if (!$entityFieldName) {
37 throw new \LogicException(
'Incorrect configuration for ' .
$entityType);
39 if (isset(
$data[$entityFieldName])) {
40 $data[$databaseFieldName] =
$data[$entityFieldName];
41 unset(
$data[$entityFieldName]);
The documentation for this class was generated from the following file: