FOF30\Model\DataModel::bind PHP Method

bind() public method

Special note if you are using a custom buildQuery with JOINs or field aliases: You will need to use addKnownField to let FOF know that the fields from your JOINs and the aliased fields should be bound to the record data. If you are using aliased fields you may also want to override the databaseDataToRecordData method. Generally, it is a BAD idea using JOINs instead of relations.
public bind ( mixed $data, mixed $ignore = [] ) : static
$data mixed An associative array or object to bind to the DataModel instance.
$ignore mixed An optional array or space separated list of properties to ignore while binding.
return static Self, for chaining
    public function bind($data, $ignore = array())
    {
        $this->triggerEvent('onBeforeBind', array(&$data));
        // If the source value is not an array or object return false.
        if (!is_object($data) && !is_array($data)) {
            throw new \InvalidArgumentException(\JText::sprintf('LIB_FOF_MODEL_ERR_BIND', get_class($this), gettype($data)));
        }
        // If the ignore value is a string, explode it over spaces.
        if (!is_array($ignore)) {
            $ignore = explode(' ', $ignore);
        }
        // Bind the source value, excluding the ignored fields.
        foreach ($this->recordData as $k => $currentValue) {
            // Only process fields not in the ignore array.
            if (!in_array($k, $ignore)) {
                if (is_array($data) && isset($data[$k])) {
                    $this->setFieldValue($k, $data[$k]);
                } elseif (is_object($data) && isset($data->{$k})) {
                    $this->setFieldValue($k, $data->{$k});
                }
            }
        }
        // Perform data transformation
        $this->databaseDataToRecordData();
        $this->triggerEvent('onAfterBind', array($data));
        return $this;
    }