Skip to content

Commit

Permalink
Updated the logic for calculating number of deleted records in Model-…
Browse files Browse the repository at this point in the history
…>deleteMatchingDbTableRows(array $cols_n_vals): int
  • Loading branch information
rotexdegba committed Jun 7, 2024
1 parent 6aa59f0 commit b72cb41
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
\Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector::class,
\Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector::class,
\Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector::class,
\Rector\Php80\Rector\FunctionLike\MixedTypeRector::class
];

$rectorConfigurator->skip($skipables);
Expand Down
2 changes: 1 addition & 1 deletion src/LeanOrm/DBConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class DBConnector {
* @var array<string, \PDO>
*/
protected static array $db = [];

//////////// ------------------------------------ //////////////////////////////
//////////// --- END CLASS PROPERTIES TO KEEP --- //////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 2 additions & 3 deletions src/LeanOrm/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1700,14 +1700,13 @@ public function deleteMatchingDbTableRows(array $cols_n_vals): int {
$this->logQuery($dlt_qry, $dlt_qry_params, __METHOD__, '' . __LINE__);

$matching_rows_before_delete = (int) $this->fetchValue($sel_qry_obj);

$this->db_connector->executeQuery($dlt_qry, $dlt_qry_params, true);

$matching_rows_after_delete = (int) $this->fetchValue($sel_qry_obj);

//number of deleted rows
$result = $matching_rows_before_delete - $matching_rows_after_delete;

} // if($cols_n_vals !== [])
} // if ( $cols_n_vals !== [] )

Expand Down

0 comments on commit b72cb41

Please sign in to comment.