Skip to content

Commit

Permalink
nullable proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy-j committed May 27, 2019
1 parent 3e0c8cc commit 438221b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Promise/PromiseOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(ORMInterface $orm, string $target, array $scope)
*/
public function __loaded(): bool
{
return empty($this->orm);
return $this->orm === null;
}

/**
Expand All @@ -72,6 +72,9 @@ public function __resolve()
if (!is_null($this->orm)) {
if (count($this->scope) !== 1) {
$this->resolved = $this->orm->getRepository($this->target)->findOne($this->scope);
} elseif ($this->scope === []) {
// nothing to proxy to
$this->orm = null;
} else {
$key = key($this->scope);
$value = $this->scope[$key];
Expand Down

0 comments on commit 438221b

Please sign in to comment.