|
@@ 38-50 (lines=13) @@
|
| 35 |
|
$hasSessionEntity = $this->container->has(SessionEntityInterface::class); |
| 36 |
|
$hasSessionRepository = $this->container->has(SessionRepositoryInterface::class); |
| 37 |
|
|
| 38 |
|
if ($hasUserEntity && !$hasUserRepository) { |
| 39 |
|
$userEntity = $this->container->get(UserEntityInterface::class); |
| 40 |
|
if ($userEntity instanceof DoctrineUserEntity) { |
| 41 |
|
$em = $this->container->get(EntityManager::class); |
| 42 |
|
$this->items[UserRepositoryInterface::class] = function () use ($em, $userEntity) { |
| 43 |
|
return new DoctrineUserRepository($em, $em->getClassMetadata(get_class($userEntity))); |
| 44 |
|
}; |
| 45 |
|
} elseif ($userEntity instanceof EloquentUserEntity) { |
| 46 |
|
$this->items[UserRepositoryInterface::class] = function () { |
| 47 |
|
return new EloquentUserRepository(); |
| 48 |
|
}; |
| 49 |
|
} |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
if ($hasSessionEntity && !$hasSessionRepository) { |
| 53 |
|
$sessionEntity = $this->container->get(SessionEntityInterface::class); |
|
@@ 52-64 (lines=13) @@
|
| 49 |
|
} |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
if ($hasSessionEntity && !$hasSessionRepository) { |
| 53 |
|
$sessionEntity = $this->container->get(SessionEntityInterface::class); |
| 54 |
|
if ($sessionEntity instanceof DoctrineSessionEntity) { |
| 55 |
|
$em = $this->container->get(EntityManager::class); |
| 56 |
|
$this->items[SessionRepositoryInterface::class] = function () use ($em, $sessionEntity) { |
| 57 |
|
return new DoctrineSessionRepository($em, $em->getClassMetadata(get_class($sessionEntity))); |
| 58 |
|
}; |
| 59 |
|
} elseif ($sessionEntity instanceof EloquentSessionEntity) { |
| 60 |
|
$this->items[SessionRepositoryInterface::class] = function () { |
| 61 |
|
return new EloquentSessionRepository(); |
| 62 |
|
}; |
| 63 |
|
} |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function get($id) |