atk4\data\Join_SQL::initSelectQuery PHP Method

initSelectQuery() public method

Before query is executed, this method will be called.
public initSelectQuery ( $model, $query )
    public function initSelectQuery($model, $query)
    {
        // if ON is set, we don't have to worry about anything
        if ($this->on) {
            $query->join($this->foreign_table . ' ' . $this->foreign_alias, $this->on instanceof \atk4\dsql\Expression ? $this->on : $query->expr($this->on), $this->kind);
            return;
        }
        $query->join($this->foreign_table . (isset($this->foreign_alias) ? ' ' . $this->foreign_alias : ''), $query->expr('{}.{} = {}', [isset($this->foreign_alias) ? $this->foreign_alias : $this->foreign_table, $this->foreign_field, $this->owner->getElement($this->master_field)]), $this->kind);
        /*
                if ($this->reverse) {
           $query->field([$this->short_name => ($this->join ?:
               (
                   (isset($this->owner->table_alias) ? $this->owner->table_alias : $this->owner->table)
                   .'.'.$this->master_field)
           )]);
                } else {
           $query->field([$this->short_name => $this->foreign_alias.'.'.$this->foreign_field]);
                }
        */
    }