File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 88 * Base Model
99 *
1010 * @author Nick Tsai <myintaer@gmail.com>
11- * @version 2.17.1
11+ * @version 2.18.0
1212 * @see https://github.com/yidas/codeigniter-model
1313 */
1414class Model extends \CI_Model implements \ArrayAccess
@@ -484,7 +484,7 @@ public function setAlias($alias)
484484 */
485485 public function find ($ withAll =false )
486486 {
487- $ instance = new static ;
487+ $ instance = ( isset ( $ this )) ? $ this : new static ;
488488
489489 // One time setting reset mechanism
490490 if ($ instance ->_cleanNextFind === true ) {
@@ -538,7 +538,7 @@ public function forceFind()
538538 */
539539 public static function findOne ($ condition =[])
540540 {
541- $ instance = new static ;
541+ $ instance = ( isset ( $ this )) ? $ this : new static ;
542542
543543 $ record = $ instance ->_findByCondition ($ condition )
544544 ->limit (1 )
@@ -567,7 +567,7 @@ public static function findOne($condition=[])
567567 */
568568 public static function findAll ($ condition =[], $ limit =null )
569569 {
570- $ instance = new static ;
570+ $ instance = ( isset ( $ this )) ? $ this : new static ;
571571
572572 $ query = $ instance ->_findByCondition ($ condition );
573573
You can’t perform that action at this time.
0 commit comments