- Added limitation on fixedValue in Where attribute
This commit is contained in:
1 parent
1fac12c928
commit
589524ca3a
5 files changed
+28
-19
No files matched your search
@@ -13,7 +13,7 @@ class Where {
|
||||
public string $operator = Query\Where::OPERATOR_EQUAL,
|
||||
public string $condition = Query\Where::CONDITION_AND,
|
||||
public string|\Stringable|array|null $fieldValue = null,
|
||||
public null|array $generateValue = null,
|
||||
public null|array|\Closure $generateValue = null,
|
||||
) {
|
||||
$this->field = Attribute::handleArrayField($field);
|
||||
$this->fieldValue = Attribute::handleArrayField($fieldValue);
|
||||
@@ -29,6 +29,9 @@ class Where {
|
||||
throw new \Exception(sprintf("Could not generate value from non-instanciated entity for field %s.", (string) $this->field));
|
||||
}
|
||||
}
|
||||
elseif ($this->fieldValue && $entity) {
|
||||
throw new \Exception(sprintf("Field value, from %s, could not be included in query since the entity is already loaded; it is meant to be used with a OneToOne relation loaded within a join.", (string) $this->fieldValue));
|
||||
}
|
||||
|
||||
return $this->fieldValue ?? $this->value;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user