Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Update SelectQuery.php
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Apr 12, 2017
1 parent 58928d0 commit a6a2a7a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/ORM/SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,20 @@ public function findOne($asObject = true)
'state' => Entity::STATE_QUERY,
'tableName' => $table
]);

$object(Entity::STATE_LOADED);


if (!$object)
{
$object = new $model(
$this->builder,
Entity::STATE_CREATED,
$table
);
}
else
{
$object(Entity::STATE_LOADED);
}

return $object;
}

Expand Down Expand Up @@ -147,4 +158,4 @@ public function raw($sql, array $parameters = [])
return $statement;
}

}
}

0 comments on commit a6a2a7a

Please sign in to comment.