FOF30\Model\DataModel::addKnownField PHP Method

addKnownField() public method

Basically, if you find yourself using this method you are probably doing something very wrong or very advanced. If you do not feel confident with debugging FOF code STOP WHATEVER YOU'RE DOING and rethink your Model. Why are you using a JOIN? If you want to filter the records by a field found in another table you can still use relations and whereHas with a callback. If you want to display data from related entries in an XML form you can do that with relations, using the dot notation (name_from="relationName.fieldName"). If you want to do advanced grouping of records (GROUP clauses) then allright, you can't use relations. But if you are doing this kind of advanced stuff you needn't be reading introductory texts like this so get back to coding already!
public addKnownField ( string $fieldName, mixed $default = null, string $type = 'integer', boolean $replace = false )
$fieldName string The name of the field
$default mixed Default value, used by reset() (default: null)
$type string Database type for the field. If unsure use 'integer', 'float' or 'text'.
$replace boolean Should we replace an existing known field definition?
    public function addKnownField($fieldName, $default = null, $type = 'integer', $replace = false)
    {
        if (array_key_exists($fieldName, $this->knownFields) && !$replace) {
            return $this;
        }
        $info = (object) array('Default' => $default, 'Type' => $type);
        $this->knownFields[$fieldName] = $info;
        // Initialize only the null or not yet set records
        if (!isset($this->recordData[$fieldName])) {
            $this->recordData[$fieldName] = $default;
        }
        return $this;
    }