Skip to content

Commit bfa08f7

Browse files
replace whereCondition method to OperationsTrait
1 parent efb57f8 commit bfa08f7

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/Operations/OperationsTrait.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Effectra\SqlQuery\Operations;
66

7+
use Effectra\SqlQuery\Condition;
78

89
trait OperationsTrait
910
{
@@ -17,6 +18,15 @@ public function addQuery(string $query)
1718
$this->setAttribute('query', $query);
1819
}
1920

21+
public function whereConditions(Condition $conditions):self
22+
{
23+
$condition = $conditions->getAttributes() ;
24+
foreach ($condition['where'] as $attr) {
25+
$this->addToAttribute('where',$attr);
26+
}
27+
return $this;
28+
}
29+
2030
/**
2131
* Add a WHERE clause to the SQL query.
2232
*

src/Operations/Update.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ public function __construct(string $table)
3535
$this->setAttribute('insert_data_mode', Insert::INSERT_VALUES_MODE_NORMAL);
3636
}
3737

38-
public function whereConditions(Condition $conditions):self
39-
{
40-
$condition = $conditions->getAttributes() ;
41-
foreach ($condition['where'] as $attr) {
42-
$this->addToAttribute('where',$attr);
43-
}
44-
return $this;
45-
}
46-
4738
/**
4839
* Get the SQL query generated by the Update operation.
4940
*

0 commit comments

Comments
 (0)