@@ -619,6 +619,11 @@ public function insert($data = null, bool $returnID = true)
619619 $ this ->tempData = [];
620620 }
621621
622+ if (empty ($ data ))
623+ {
624+ throw DataException::forEmptyDataset ('insert ' );
625+ }
626+
622627 // If $data is using a custom class with public or protected
623628 // properties representing the table elements, we need to grab
624629 // them as an array.
@@ -668,11 +673,6 @@ public function insert($data = null, bool $returnID = true)
668673
669674 $ data = $ this ->trigger ('beforeInsert ' , ['data ' => $ data ]);
670675
671- if (empty ($ data ))
672- {
673- throw DataException::forEmptyDataset ('insert ' );
674- }
675-
676676 // Must use the set() method to ensure objects get converted to arrays
677677 $ result = $ this ->builder ()
678678 ->set ($ data ['data ' ], '' , $ escape )
@@ -749,6 +749,11 @@ public function update($id = null, $data = null): bool
749749 $ this ->tempData = [];
750750 }
751751
752+ if (empty ($ data ))
753+ {
754+ throw DataException::forEmptyDataset ('update ' );
755+ }
756+
752757 // If $data is using a custom class with public or protected
753758 // properties representing the table elements, we need to grab
754759 // them as an array.
@@ -790,11 +795,6 @@ public function update($id = null, $data = null): bool
790795
791796 $ data = $ this ->trigger ('beforeUpdate ' , ['id ' => $ id , 'data ' => $ data ]);
792797
793- if (empty ($ data ))
794- {
795- throw DataException::forEmptyDataset ('update ' );
796- }
797-
798798 $ builder = $ this ->builder ();
799799
800800 if ($ id )
@@ -956,9 +956,9 @@ public function onlyDeleted()
956956 * @param null $data
957957 * @param boolean $returnSQL
958958 *
959- * @return boolean TRUE on success, FALSE on failure
959+ * @return mixed
960960 */
961- public function replace ($ data = null , bool $ returnSQL = false ): bool
961+ public function replace ($ data = null , bool $ returnSQL = false )
962962 {
963963 // Validate data before saving.
964964 if (! empty ($ data ) && $ this ->skipValidation === false )
@@ -1317,7 +1317,7 @@ public function setValidationMessage(string $field, array $fieldMessages)
13171317 * Validate the data against the validation rules (or the validation group)
13181318 * specified in the class property, $validationRules.
13191319 *
1320- * @param array $data
1320+ * @param array|object $data
13211321 *
13221322 * @return boolean
13231323 */
0 commit comments