@@ -430,12 +430,12 @@ public function getDatabaseEngine(): string
430430 /**
431431 * function to find one record and assign in to current object.
432432 * @param int|string $id If call this function using this param, will find record by using this id. If not set, just find the first record in database.
433- * @return bool| ActiveRecord if find record, assign in to current object and return it, other wise return "false" .
433+ * @return ActiveRecord Returns a hydrated ActiveRecord object if found, otherwise returns an empty ActiveRecord object .
434434 */
435435 public function find ($ id = null )
436436 {
437437 if ($ id !== null ) {
438- $ this ->resetQueryData ()-> eq ($ this ->primaryKey , $ id );
438+ $ this ->eq ($ this ->primaryKey , $ id );
439439 }
440440
441441 $ this ->processEvent ('beforeFind ' , [ $ this ]);
@@ -446,6 +446,7 @@ public function find($id = null)
446446
447447 return $ result ;
448448 }
449+
449450 /**
450451 * function to find all records in database.
451452 * @return array<int,ActiveRecord> return array of ActiveRecord
@@ -577,7 +578,7 @@ public function execute(string $sql, array $params = []): DatabaseStatementInter
577578 * @param array $param The param will be bind to PDOStatement.
578579 * @param ActiveRecord|null $obj The object, if find record in database, will assign the attributes in to this object.
579580 * @param bool $single if set to true, will find record and fetch in current object, otherwise will find all records.
580- * @return bool| ActiveRecord|array
581+ * @return ActiveRecord|array
581582 */
582583 public function query (string $ sql , array $ param = [], ?ActiveRecord $ obj = null , bool $ single = false )
583584 {
0 commit comments