@@ -84,6 +84,13 @@ class Model extends BaseModel
8484 */
8585 protected $ tempData = [];
8686
87+ /**
88+ * Escape Parameter to be passed in do methods
89+ *
90+ * @var boolean|null
91+ */
92+ protected $ escape = null ;
93+
8794 // endregion
8895
8996 // region Constructor
@@ -243,13 +250,15 @@ protected function doFirst()
243250 * Inserts data into the current table.
244251 * This methods works only with dbCalls
245252 *
246- * @param array $data Data
247- * @param boolean|null $escape Escape
253+ * @param array $data Data
248254 *
249255 * @return BaseResult|integer|string|false
250256 */
251- protected function doInsert (array $ data, ? bool $ escape = null )
257+ protected function doInsert (array $ data )
252258 {
259+ $ escape = $ this ->escape ;
260+ $ this ->escape = null ;
261+
253262 // Require non empty primaryKey when
254263 // not using auto-increment feature
255264 if (! $ this ->useAutoIncrement && empty ($ data [$ this ->primaryKey ]))
@@ -320,6 +329,9 @@ protected function doInsertBatch(?array $set = null, ?bool $escape = null, int $
320329 */
321330 protected function doUpdate ($ id = null , $ data = null , ?bool $ escape = null ): bool
322331 {
332+ $ escape = $ this ->escape ;
333+ $ this ->escape = null ;
334+
323335 $ builder = $ this ->builder ();
324336
325337 if ($ id )
@@ -655,46 +667,44 @@ protected function shouldUpdate($data) : bool
655667 *
656668 * @param array|object|null $data Data
657669 * @param boolean $returnID Whether insert ID should be returned or not.
658- * @param boolean|null $escape Escape
659670 *
660671 * @return BaseResult|object|integer|string|false
661672 *
662673 * @throws ReflectionException
663674 */
664- public function insert ($ data = null , bool $ returnID = true , ? bool $ escape = null )
675+ public function insert ($ data = null , bool $ returnID = true )
665676 {
666677 if (empty ($ data ))
667678 {
668679 $ data = $ this ->tempData ['data ' ] ?? null ;
669- $ escape = $ this ->tempData ['escape ' ] ?? null ;
680+ $ this -> escape = $ this ->tempData ['escape ' ] ?? null ;
670681 $ this ->tempData = [];
671682 }
672683
673- return parent ::insert ($ data , $ returnID, $ escape );
684+ return parent ::insert ($ data , $ returnID );
674685 }
675686
676687 /**
677688 * Updates a single record in the database. If an object is provided,
678689 * it will attempt to convert it into an array.
679690 *
680- * @param integer|array|string|null $id ID
681- * @param array|object|null $data Data
682- * @param boolean|null $escape Escape
691+ * @param integer|array|string|null $id ID
692+ * @param array|object|null $data Data
683693 *
684694 * @return boolean
685695 *
686696 * @throws ReflectionException
687697 */
688- public function update ($ id = null , $ data = null , ? bool $ escape = null ): bool
698+ public function update ($ id = null , $ data = null ): bool
689699 {
690700 if (empty ($ data ))
691701 {
692702 $ data = $ this ->tempData ['data ' ] ?? null ;
693- $ escape = $ this ->tempData ['escape ' ] ?? null ;
703+ $ this -> escape = $ this ->tempData ['escape ' ] ?? null ;
694704 $ this ->tempData = [];
695705 }
696706
697- return parent ::update ($ id , $ data, $ escape );
707+ return parent ::update ($ id , $ data );
698708 }
699709
700710 // endregion
0 commit comments