FOF30\Model\DataModel::with PHP Method

with() public method

array('relation1', 'relation2') Eager load relation1 and relation2 without any callbacks array('relation1' => $callable1, 'relation2' => $callable2) Eager load relation1 with callback $callable1 etc array('relation1', 'relation2' => $callable2) Eager load relation1 without a callback, relation2 with callback $callable2 The callback must have the signature function(\JDatabaseQuery $query) and doesn't return a value. It is supposed to modify the query directly. Please note that eager loaded relations produce their queries without going through the respective model. Instead they generate a SQL query directly, then map the loaded results into a DataCollection.
public with ( array $relations )
$relations array The relations to eager load. See above for more information.
    public function with(array $relations)
    {
        if (empty($relations)) {
            $this->eagerRelations = array();
            return $this;
        }
        $knownRelations = $this->relationManager->getRelationNames();
        foreach ($relations as $k => $v) {
            if (is_callable($v)) {
                $relName = $k;
                $callback = $v;
            } else {
                $relName = $v;
                $callback = null;
            }
            if (in_array($relName, $knownRelations)) {
                $this->eagerRelations[$relName] = $callback;
            }
        }
        return $this;
    }