atk4\data\Join_Array::beforeInsert PHP Method

beforeInsert() public method

public beforeInsert ( $model, &$data )
    public function beforeInsert($model, &$data)
    {
        if ($this->weak) {
            return;
        }
        if ($model->hasElement($this->master_field) && $model[$this->master_field]) {
            // The value for the master_field is set,
            // we are going to use existing record.
            return;
        }
        // Figure out where are we going to save data
        $persistence = $this->persistence ?: $this->owner->persistence;
        $this->id = $persistence->insert($model, $this->save_buffer, $this->foreign_table);
        $data[$this->master_field] = $this->id;
        //$this->owner->set($this->master_field, $this->id);
    }