Skip to content

Commit

Permalink
Merge pull request #148 from creative-commoners/pulls/2.0/set-then-re…
Browse files Browse the repository at this point in the history
…turn

MINOR Switch logic in getDataObjectInstance to be slightly more readable
  • Loading branch information
ScopeyNZ committed Jan 9, 2019
2 parents 03248c4 + 7188362 commit c58711c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Scaffolding/Traits/DataObjectTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ protected function typeName()
*/
public function getDataObjectInstance()
{
if ($this->dataObjectInstance) {
return $this->dataObjectInstance;
if (!$this->dataObjectInstance) {
$this->dataObjectInstance = Injector::inst()->get($this->dataObjectClass);
}

return $this->dataObjectInstance = Injector::inst()->get($this->dataObjectClass);
return $this->dataObjectInstance;
}

/**
Expand Down

0 comments on commit c58711c

Please sign in to comment.