src/Row.php
public function &__get(string $name)
    {
        if ($name === 'id') {
            return $this->values['id'];
        }

        //It's a value
        if ($valueName = $this->getValueName($name)) {
            $value = $this->getValue($valueName);
            return $value;
        }

        //It's custom data
        if (array_key_exists($name, $this->data)) {
            return $this->data[$name];
        }

        $db = $this->table->getDatabase();

        if (isset($db->$name)) {
            $this->setData([
                $name => $this->select($db->$name)->run(),
            ]);

            return $this->data[$name];
        }

        throw new RuntimeException(
            sprintf('Undefined property "%s" in the table %s', $name, $this->table)
        );
    }
public function &__get(string $name)
    {
        if ($name === 'id') {
            return $this->values['id'];
        }

        //It's a value
        if ($valueName = $this->getValueName($name)) {
            $value = $this->getValue($valueName);
            return $value;
        }

        //It's custom data
        if (array_key_exists($name, $this->data)) {
            return $this->data[$name];
        }

        $db = $this->table->getDatabase();

        if (isset($db->$name)) {
            $this->setData([
                $name => $this->select($db->$name)->run(),
            ]);

            return $this->data[$name];
        }

        throw new RuntimeException(
            sprintf('Undefined property "%s" in the table %s', $name, $this->table)
        );
    }
Returns the value of:
- a value field
- a related table