- Some work done on correcting LDAP package compatibility

This commit is contained in:
mcndave committed 2021-03-09 15:25:46 +00:00
1 parent 71de0a8ac1
commit e3d0e45a4e
13 files changed
+110 -22

No files matched your search

+7
View File
@@ -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)));
}
}
}
+2
View File
@@ -18,6 +18,8 @@ class GroupBy extends Fragment {
public function add(string $field) : self
{
$this->validateFieldType($field);
$this->groupBy[] = $field;
return $this;
+6 -1
View File
@@ -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 ) ) {
-7
View File
@@ -1,7 +0,0 @@
<?php
namespace Ulmus\Query;
class Like extends Fragment {
}
+2
View File
@@ -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
View File
@@ -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()