- Some work done on correcting LDAP package compatibility
This commit is contained in:
1 parent
71de0a8ac1
commit
e3d0e45a4e
13 files changed
+110
-22
No files matched your search
@@ -28,4 +28,11 @@ abstract class Fragment {
|
||||
|
||||
return implode(", ", $list);
|
||||
}
|
||||
|
||||
protected function validateFieldType($field) : void
|
||||
{
|
||||
if ( is_numeric($field) ) {
|
||||
throw new \Ulmus\Exception\InvalidFieldType(sprintf("Validation of field `%s` failed from query `%s`", $field, get_class($this)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ class GroupBy extends Fragment {
|
||||
|
||||
public function add(string $field) : self
|
||||
{
|
||||
$this->validateFieldType($field);
|
||||
|
||||
$this->groupBy[] = $field;
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -29,6 +29,9 @@ class Having extends Fragment {
|
||||
|
||||
public function add($field, $value, string $operator, string $condition, bool $not = false) : self
|
||||
{
|
||||
$this->validateFieldType($field);
|
||||
# $this->validateValueType($value);
|
||||
|
||||
$this->conditionList[] = [
|
||||
$field,
|
||||
$value,
|
||||
@@ -102,7 +105,8 @@ class Having extends Fragment {
|
||||
return (in_array($this->operator, [ '!=', '<>' ]) ? Where::CONDITION_NOT . " " : "") . Where::COMPARISON_IN;
|
||||
}
|
||||
|
||||
return $this->operator;
|
||||
# whitelisting operators
|
||||
return in_array(strtoupper($this->operator), [ '=', '!=', '<>', 'LIKE' ]) ? $this->operator : "=";
|
||||
}
|
||||
|
||||
protected function value()
|
||||
@@ -124,6 +128,7 @@ class Having extends Fragment {
|
||||
{
|
||||
if ( $value === null ) {
|
||||
$this->operator = in_array($this->operator, [ '!=', '<>' ]) ? Where::COMPARISON_IS . " " . Where::CONDITION_NOT : Where::COMPARISON_IS;
|
||||
|
||||
return Where::COMPARISON_NULL;
|
||||
}
|
||||
elseif ( is_object($value) && ( $value instanceof EntityField ) ) {
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Query;
|
||||
|
||||
class Like extends Fragment {
|
||||
|
||||
}
|
||||
@@ -18,6 +18,8 @@ class OrderBy extends Fragment {
|
||||
|
||||
public function add(string $field, ? string $direction = null) : self
|
||||
{
|
||||
$this->validateFieldType($field);
|
||||
|
||||
$this->orderBy[] = [ $field, $direction ];
|
||||
|
||||
return $this;
|
||||
|
||||
+5
-1
@@ -37,6 +37,9 @@ class Where extends Fragment {
|
||||
|
||||
public function add($field, $value, string $operator, string $condition, bool $not = false) : self
|
||||
{
|
||||
$this->validateFieldType($field);
|
||||
# $this->validateValueType($value);
|
||||
|
||||
$this->conditionList[] = [
|
||||
$field,
|
||||
$value,
|
||||
@@ -110,7 +113,8 @@ class Where extends Fragment {
|
||||
return (in_array($this->operator, [ '!=', '<>' ]) ? Where::CONDITION_NOT . " " : "") . Where::COMPARISON_IN;
|
||||
}
|
||||
|
||||
return $this->operator;
|
||||
# whitelisting operators
|
||||
return in_array(strtoupper($this->operator), [ '=', '!=', '<>', 'LIKE' ]) ? $this->operator : "=";
|
||||
}
|
||||
|
||||
protected function value()
|
||||
|
||||
Reference in new issue
Block a user