FOF30\Model\DataModel::__set PHP Method

__set() public method

Tip: Trying to set fltSomething will always return the value of the state variable "something" Tip: Trying to set scopeSomething will always return the value of the dynamic scope filter "something" Tip: You can define custom field setter methods as setFieldNameAttribute, where FieldName is your field's name, in CamelCase (even if the field name itself is in snake_case).
public __set ( string $name, mixed $value ) : void
$name string The name of the field / scope / state variable to set
$value mixed The value to set
return void
    public function __set($name, $value)
    {
        $isState = false;
        $isScope = false;
        if (substr($name, 0, 3) == 'flt') {
            $isState = true;
            $name = strtolower(substr($name, 3, 1)) . substr($name, 4);
        } elseif (substr($name, 0, 5) == 'scope') {
            $isScope = true;
            $name = strtolower(substr($name, 5, 1)) . substr($name, 5);
        }
        // If $name is a field name, set its value
        if (!$isState && !$isScope && array_key_exists($name, $this->recordData)) {
            $this->setFieldValue($name, $value);
        } elseif (!$isState && !$isScope && array_key_exists($name, $this->aliasFields) && array_key_exists($this->aliasFields[$name], $this->recordData)) {
            $name = $this->aliasFields[$name];
            $this->setFieldValue($name, $value);
        } elseif ($isScope || method_exists($this, 'scope' . ucfirst($name))) {
            $method = 'scope' . ucfirst($name);
            $this->{$method}($value);
        } else {
            $this->setState($name, $value);
        }
    }