Skip to content

Commit

Permalink
replace whereCondition method to OperationsTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
BMTmohammedtaha committed Sep 25, 2023
1 parent efb57f8 commit bfa08f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 10 additions & 0 deletions src/Operations/OperationsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Effectra\SqlQuery\Operations;

use Effectra\SqlQuery\Condition;

trait OperationsTrait
{
Expand All @@ -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.
*
Expand Down
9 changes: 0 additions & 9 deletions src/Operations/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit bfa08f7

Please sign in to comment.