2020-04-02 00:02:51 +02:00
|
|
|
<?php
|
|
|
|
|
2022-11-18 18:06:46 +01:00
|
|
|
namespace Core\Driver\SQL\Condition;
|
2020-04-02 00:02:51 +02:00
|
|
|
|
2023-01-05 22:47:17 +01:00
|
|
|
use Core\Driver\SQL\SQL;
|
|
|
|
|
2020-04-02 00:02:51 +02:00
|
|
|
class CondAnd extends Condition {
|
|
|
|
|
2020-04-03 17:39:58 +02:00
|
|
|
private array $conditions;
|
2020-04-02 00:02:51 +02:00
|
|
|
|
|
|
|
public function __construct(...$conditions) {
|
|
|
|
$this->conditions = $conditions;
|
|
|
|
}
|
|
|
|
|
2021-04-02 21:58:06 +02:00
|
|
|
public function getConditions(): array { return $this->conditions; }
|
2023-01-05 22:47:17 +01:00
|
|
|
|
|
|
|
function getExpression(SQL $sql, array &$params): string {
|
|
|
|
$conditions = array();
|
|
|
|
foreach($this->getConditions() as $cond) {
|
|
|
|
$conditions[] = $sql->addValue($cond, $params);
|
|
|
|
}
|
|
|
|
return "(" . implode(" AND ", $conditions) . ")";
|
|
|
|
}
|
2020-04-03 17:39:58 +02:00
|
|
|
}
|