@@ -479,13 +479,13 @@ abstract protected function doOnlyDeleted();
479479 * Compiles a replace and runs the query.
480480 * This method works only with dbCalls.
481481 *
482- * @param array|null $data Data
483- * @phpstan-param row_array|null $data
482+ * @param array|null $row Row data
483+ * @phpstan-param row_array|null $row
484484 * @param bool $returnSQL Set to true to return Query String
485485 *
486486 * @return BaseResult|false|Query|string
487487 */
488- abstract protected function doReplace (?array $ data = null , bool $ returnSQL = false );
488+ abstract protected function doReplace (?array $ row = null , bool $ returnSQL = false );
489489
490490 /**
491491 * Grabs the last error(s) that occurred from the Database connection.
@@ -742,27 +742,27 @@ public function getInsertID()
742742 * Inserts data into the database. If an object is provided,
743743 * it will attempt to convert it to an array.
744744 *
745- * @param array|object|null $data Data
746- * @phpstan-param row_array|object|null $data
745+ * @param array|object|null $row Row data
746+ * @phpstan-param row_array|object|null $row
747747 * @param bool $returnID Whether insert ID should be returned or not.
748748 *
749749 * @return bool|int|string insert ID or true on success. false on failure.
750750 * @phpstan-return ($returnID is true ? int|string|false : bool)
751751 *
752752 * @throws ReflectionException
753753 */
754- public function insert ($ data = null , bool $ returnID = true )
754+ public function insert ($ row = null , bool $ returnID = true )
755755 {
756756 $ this ->insertID = 0 ;
757757
758758 // Set $cleanValidationRules to false temporary.
759759 $ cleanValidationRules = $ this ->cleanValidationRules ;
760760 $ this ->cleanValidationRules = false ;
761761
762- $ data = $ this ->transformDataToArray ($ data , 'insert ' );
762+ $ row = $ this ->transformDataToArray ($ row , 'insert ' );
763763
764764 // Validate data before saving.
765- if (! $ this ->skipValidation && ! $ this ->validate ($ data )) {
765+ if (! $ this ->skipValidation && ! $ this ->validate ($ row )) {
766766 // Restore $cleanValidationRules
767767 $ this ->cleanValidationRules = $ cleanValidationRules ;
768768
@@ -774,20 +774,20 @@ public function insert($data = null, bool $returnID = true)
774774
775775 // Must be called first, so we don't
776776 // strip out created_at values.
777- $ data = $ this ->doProtectFieldsForInsert ($ data );
777+ $ row = $ this ->doProtectFieldsForInsert ($ row );
778778
779779 // doProtectFields() can further remove elements from
780780 // $data so we need to check for empty dataset again
781- if (! $ this ->allowEmptyInserts && empty ($ data )) {
781+ if (! $ this ->allowEmptyInserts && empty ($ row )) {
782782 throw DataException::forEmptyDataset ('insert ' );
783783 }
784784
785785 // Set created_at and updated_at with same time
786786 $ date = $ this ->setDate ();
787- $ data = $ this ->setCreatedField ($ data , $ date );
788- $ data = $ this ->setUpdatedField ($ data , $ date );
787+ $ row = $ this ->setCreatedField ($ row , $ date );
788+ $ row = $ this ->setUpdatedField ($ row , $ date );
789789
790- $ eventData = ['data ' => $ data ];
790+ $ eventData = ['data ' => $ row ];
791791
792792 if ($ this ->tempAllowCallbacks ) {
793793 $ eventData = $ this ->trigger ('beforeInsert ' , $ eventData );
@@ -932,12 +932,12 @@ public function insertBatch(?array $set = null, ?bool $escape = null, int $batch
932932 * it will attempt to convert it into an array.
933933 *
934934 * @param array|int|string|null $id
935- * @param array|object|null $data
936- * @phpstan-param row_array|object|null $data
935+ * @param array|object|null $row Row data
936+ * @phpstan-param row_array|object|null $row
937937 *
938938 * @throws ReflectionException
939939 */
940- public function update ($ id = null , $ data = null ): bool
940+ public function update ($ id = null , $ row = null ): bool
941941 {
942942 if (is_bool ($ id )) {
943943 throw new InvalidArgumentException ('update(): argument #1 ($id) should not be boolean. ' );
@@ -947,28 +947,28 @@ public function update($id = null, $data = null): bool
947947 $ id = [$ id ];
948948 }
949949
950- $ data = $ this ->transformDataToArray ($ data , 'update ' );
950+ $ row = $ this ->transformDataToArray ($ row , 'update ' );
951951
952952 // Validate data before saving.
953- if (! $ this ->skipValidation && ! $ this ->validate ($ data )) {
953+ if (! $ this ->skipValidation && ! $ this ->validate ($ row )) {
954954 return false ;
955955 }
956956
957957 // Must be called first, so we don't
958958 // strip out updated_at values.
959- $ data = $ this ->doProtectFields ($ data );
959+ $ row = $ this ->doProtectFields ($ row );
960960
961961 // doProtectFields() can further remove elements from
962962 // $data, so we need to check for empty dataset again
963- if (empty ($ data )) {
963+ if (empty ($ row )) {
964964 throw DataException::forEmptyDataset ('update ' );
965965 }
966966
967- $ data = $ this ->setUpdatedField ($ data , $ this ->setDate ());
967+ $ row = $ this ->setUpdatedField ($ row , $ this ->setDate ());
968968
969969 $ eventData = [
970970 'id ' => $ id ,
971- 'data ' => $ data ,
971+ 'data ' => $ row ,
972972 ];
973973
974974 if ($ this ->tempAllowCallbacks ) {
@@ -1167,22 +1167,22 @@ public function onlyDeleted()
11671167 /**
11681168 * Compiles a replace and runs the query.
11691169 *
1170- * @param array|null $data Data
1171- * @phpstan-param row_array|null $data
1170+ * @param array|null $row Row data
1171+ * @phpstan-param row_array|null $row
11721172 * @param bool $returnSQL Set to true to return Query String
11731173 *
11741174 * @return BaseResult|false|Query|string
11751175 */
1176- public function replace (?array $ data = null , bool $ returnSQL = false )
1176+ public function replace (?array $ row = null , bool $ returnSQL = false )
11771177 {
11781178 // Validate data before saving.
1179- if (($ data !== null ) && ! $ this ->skipValidation && ! $ this ->validate ($ data )) {
1179+ if (($ row !== null ) && ! $ this ->skipValidation && ! $ this ->validate ($ row )) {
11801180 return false ;
11811181 }
11821182
1183- $ data = $ this ->setUpdatedField ((array ) $ data , $ this ->setDate ());
1183+ $ row = $ this ->setUpdatedField ((array ) $ row , $ this ->setDate ());
11841184
1185- return $ this ->doReplace ($ data , $ returnSQL );
1185+ return $ this ->doReplace ($ row , $ returnSQL );
11861186 }
11871187
11881188 /**
@@ -1749,48 +1749,48 @@ protected function objectToRawArray($object, bool $onlyChanged = true, bool $rec
17491749 /**
17501750 * Transform data to array.
17511751 *
1752- * @param array|object|null $data Data
1753- * @phpstan-param row_array|object|null $data
1752+ * @param array|object|null $row Row data
1753+ * @phpstan-param row_array|object|null $row
17541754 * @param string $type Type of data (insert|update)
17551755 *
17561756 * @throws DataException
17571757 * @throws InvalidArgumentException
17581758 * @throws ReflectionException
17591759 */
1760- protected function transformDataToArray ($ data , string $ type ): array
1760+ protected function transformDataToArray ($ row , string $ type ): array
17611761 {
17621762 if (! in_array ($ type , ['insert ' , 'update ' ], true )) {
17631763 throw new InvalidArgumentException (sprintf ('Invalid type "%s" used upon transforming data to array. ' , $ type ));
17641764 }
17651765
1766- if (! $ this ->allowEmptyInserts && empty ($ data )) {
1766+ if (! $ this ->allowEmptyInserts && empty ($ row )) {
17671767 throw DataException::forEmptyDataset ($ type );
17681768 }
17691769
17701770 // If $data is using a custom class with public or protected
17711771 // properties representing the collection elements, we need to grab
17721772 // them as an array.
1773- if (is_object ($ data ) && ! $ data instanceof stdClass) {
1773+ if (is_object ($ row ) && ! $ row instanceof stdClass) {
17741774 // If it validates with entire rules, all fields are needed.
17751775 $ onlyChanged = ($ this ->skipValidation === false && $ this ->cleanValidationRules === false )
17761776 ? false : ($ type === 'update ' );
17771777
1778- $ data = $ this ->objectToArray ($ data , $ onlyChanged , true );
1778+ $ row = $ this ->objectToArray ($ row , $ onlyChanged , true );
17791779 }
17801780
17811781 // If it's still a stdClass, go ahead and convert to
17821782 // an array so doProtectFields and other model methods
17831783 // don't have to do special checks.
1784- if (is_object ($ data )) {
1785- $ data = (array ) $ data ;
1784+ if (is_object ($ row )) {
1785+ $ row = (array ) $ row ;
17861786 }
17871787
17881788 // If it's still empty here, means $data is no change or is empty object
1789- if (! $ this ->allowEmptyInserts && empty ($ data )) {
1789+ if (! $ this ->allowEmptyInserts && empty ($ row )) {
17901790 throw DataException::forEmptyDataset ($ type );
17911791 }
17921792
1793- return $ data ;
1793+ return $ row ;
17941794 }
17951795
17961796 /**
0 commit comments