Skip to content

Commit

Permalink
Fix static find instance
Browse files Browse the repository at this point in the history
  • Loading branch information
yidas committed Apr 27, 2019
1 parent 287311f commit 8cb3a1d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Base Model
*
* @author Nick Tsai <[email protected]>
* @version 2.17.1
* @version 2.18.0
* @see https://github.com/yidas/codeigniter-model
*/
class Model extends \CI_Model implements \ArrayAccess
Expand Down Expand Up @@ -484,7 +484,7 @@ public function setAlias($alias)
*/
public function find($withAll=false)
{
$instance = new static;
$instance = (isset($this)) ? $this : new static;

// One time setting reset mechanism
if ($instance->_cleanNextFind === true) {
Expand Down Expand Up @@ -538,7 +538,7 @@ public function forceFind()
*/
public static function findOne($condition=[])
{
$instance = new static;
$instance = (isset($this)) ? $this : new static;

$record = $instance->_findByCondition($condition)
->limit(1)
Expand Down Expand Up @@ -567,7 +567,7 @@ public static function findOne($condition=[])
*/
public static function findAll($condition=[], $limit=null)
{
$instance = new static;
$instance = (isset($this)) ? $this : new static;

$query = $instance->_findByCondition($condition);

Expand Down

0 comments on commit 8cb3a1d

Please sign in to comment.