field = Attribute::handleArrayField($field); $this->fieldValue = Attribute::handleArrayField($fieldValue); } public function getValue(/* null|EntityInterface */ $entity = null) : mixed { if ($this->generateValue) { if ($entity) { return call_user_func_array($this->generateValue, [ $entity ]); } else { 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; } }