6 Commits

Author SHA1 Message Date
3b1902ed1a Include AND when not specified in condition 2022-09-12 20:59:27 -03:00
e7ab3fb8b7 FIX: ? placeholder was quoted 2022-09-09 15:42:07 -04:00
a22a927bb4 FIX: make instead of get 2022-09-09 14:09:13 -04:00
2fd0af5c2f FIX 2022-09-09 12:19:03 -04:00
0f4438bd5f FIX dependency and add Readme 2022-09-08 22:14:18 -04:00
9eef089b85 First working copy 2022-09-08 17:43:20 -04:00

View File

@ -105,7 +105,19 @@ abstract class Select extends Query implements SelectInterface
}
public function getJoinString(): string
{
return implode(' ', $this->getJoins());
$str = [];
foreach ($this->getJoins() as $i => $join) {
if ($i === 0) {
$str []= $join;
continue;
}
if (!str_contains('and ', strtolower($join)) and !str_contains('or ', strtolower($join))) {
$str []= "AND {$join}";
continue;
}
$str []= $join;
}
return implode(' ', $str);
}
protected array $conditions;
public function setConditions(array $conditions): SelectInterface
@ -126,7 +138,19 @@ abstract class Select extends Query implements SelectInterface
}
public function getConditionString(): string
{
return implode(' ', $this->getConditions());
$str = [];
foreach ($this->getConditions() as $i => $condition) {
if ($i === 0) {
$str []= $condition;
continue;
}
if (!str_contains('and ', strtolower($condition)) and !str_contains('or ', strtolower($condition))) {
$str []= "AND {$condition}";
continue;
}
$str []= $condition;
}
return implode(' ', $str);
}
protected array $groups;
public function setGroups(array $groups): SelectInterface