Skip to content

Commit

Permalink
Add doctrine instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
valentin v / vvval committed May 28, 2019
1 parent 01d8db9 commit a316457
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public function __construct(
*/
public function promise(ORMInterface $orm, string $role, array $scope): ?ReferenceInterface
{
if (isset($this->resolved[$role])) {
return $this->instantiate($this->resolved[$role], $orm, $role, $scope);
}

$class = $orm->getSchema()->define($role, Schema::ENTITY);
if (empty($class)) {
return null;
Expand All @@ -71,6 +67,10 @@ public function promise(ORMInterface $orm, string $role, array $scope): ?Referen
throw ProxyFactoryException::wrap($e);
}

if (isset($this->resolved[$role])) {
return $this->instantiate($reflection, $this->resolved[$role], $orm, $role, $scope);
}

$parent = Declarations::createParentFromReflection($reflection);
$class = Declarations::createClassFromName($this->names->make($reflection), $parent);
if (!class_exists($class->getFullName())) {
Expand Down

0 comments on commit a316457

Please sign in to comment.