Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
10 / 10 |
CRAP | |
100.00% |
33 / 33 |
| Wrappers | |
100.00% |
1 / 1 |
|
100.00% |
10 / 10 |
14 | |
100.00% |
33 / 33 |
| __construct | |
100.00% |
1 / 1 |
5 | |
100.00% |
16 / 16 |
|||
| databaseRepositories | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| databaseQueries | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| databaseEntities | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| embeddedEntities | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| databaseRepositoryWrapper | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| databaseQueryWrapper | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| databaseEntityWrapper | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| embeddedEntityWrapper | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| wrappers | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| namespace PHPixie\BundleFramework\Configuration\ORM; | |
| class Wrappers | |
| { | |
| protected $wrappersMap; | |
| protected $maps = array(); | |
| protected $names; | |
| public function __construct($bundlesOrm) | |
| { | |
| $types = array( | |
| 'databaseRepositories', | |
| 'databaseQueries', | |
| 'databaseEntities', | |
| 'embeddedEntities' | |
| ); | |
| $this->maps = array_fill_keys($types, array()); | |
| foreach($bundlesOrm->wrappersMap() as $bundleName => $ormWrappers) { | |
| foreach($types as $type) { | |
| foreach($ormWrappers->$type() as $name) { | |
| $this->maps[$type][$name] = $ormWrappers; | |
| } | |
| } | |
| } | |
| foreach($this->maps as $type => $map) { | |
| $this->names[$type] = array_keys($map); | |
| } | |
| } | |
| public function databaseRepositories() | |
| { | |
| return $this->names['databaseRepositories']; | |
| } | |
| public function databaseQueries() | |
| { | |
| return $this->names['databaseQueries']; | |
| } | |
| public function databaseEntities() | |
| { | |
| return $this->names['databaseEntities']; | |
| } | |
| public function embeddedEntities() | |
| { | |
| return $this->names['embeddedEntities']; | |
| } | |
| public function databaseRepositoryWrapper($repository) | |
| { | |
| return $this | |
| ->wrappers('databaseRepositories', $repository->modelName()) | |
| ->databaseRepositoryWrapper($repository); | |
| } | |
| public function databaseQueryWrapper($query) | |
| { | |
| return $this | |
| ->wrappers('databaseQueries', $query->modelName()) | |
| ->databaseQueryWrapper($query); | |
| } | |
| public function databaseEntityWrapper($entity) | |
| { | |
| return $this | |
| ->wrappers('databaseEntities', $entity->modelName()) | |
| ->databaseEntityWrapper($entity); | |
| } | |
| public function embeddedEntityWrapper($entity) | |
| { | |
| return $this | |
| ->wrappers('embeddedEntities', $entity->modelName()) | |
| ->embeddedEntityWrapper($entity); | |
| } | |
| protected function wrappers($type, $modelName) | |
| { | |
| return $this->maps[$type][$modelName]; | |
| } | |
| } |