| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 8 | public function fetch(Entity $me, EntityManager $entityManager) |
|
| 29 | { |
||
| 30 | 8 | $reference = $this->getOpponent()->getReference(); |
|
| 31 | 6 | if (empty($reference)) { |
|
| 32 | 2 | throw new InvalidConfiguration('Reference is not defined in opponent'); |
|
| 33 | } |
||
| 34 | 4 | $foreignKey = $this->getForeignKey($me, array_flip($reference)); |
|
| 35 | |||
| 36 | /** @var EntityFetcher $fetcher */ |
||
| 37 | 3 | $fetcher = $entityManager->fetch($this->class); |
|
| 38 | 3 | foreach ($foreignKey as $col => $value) { |
|
| 39 | 3 | $fetcher->where($col, $value); |
|
| 40 | } |
||
| 41 | |||
| 42 | 3 | return $fetcher; |
|
| 43 | } |
||
| 44 | |||
| 56 |