From bfa08f77dcedda5614f73330049d154282310867 Mon Sep 17 00:00:00 2001 From: BMTmohammedtaha Date: Mon, 25 Sep 2023 19:47:42 +0200 Subject: [PATCH] replace whereCondition method to OperationsTrait --- src/Operations/OperationsTrait.php | 10 ++++++++++ src/Operations/Update.php | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Operations/OperationsTrait.php b/src/Operations/OperationsTrait.php index 397240d..4af72ca 100644 --- a/src/Operations/OperationsTrait.php +++ b/src/Operations/OperationsTrait.php @@ -4,6 +4,7 @@ namespace Effectra\SqlQuery\Operations; +use Effectra\SqlQuery\Condition; trait OperationsTrait { @@ -17,6 +18,15 @@ public function addQuery(string $query) $this->setAttribute('query', $query); } + public function whereConditions(Condition $conditions):self + { + $condition = $conditions->getAttributes() ; + foreach ($condition['where'] as $attr) { + $this->addToAttribute('where',$attr); + } + return $this; + } + /** * Add a WHERE clause to the SQL query. * diff --git a/src/Operations/Update.php b/src/Operations/Update.php index 6e1bb55..03cf74f 100644 --- a/src/Operations/Update.php +++ b/src/Operations/Update.php @@ -35,15 +35,6 @@ public function __construct(string $table) $this->setAttribute('insert_data_mode', Insert::INSERT_VALUES_MODE_NORMAL); } - public function whereConditions(Condition $conditions):self - { - $condition = $conditions->getAttributes() ; - foreach ($condition['where'] as $attr) { - $this->addToAttribute('where',$attr); - } - return $this; - } - /** * Get the SQL query generated by the Update operation. *