src/CRUD.php
public function setModel(\atk4\data\Model $m, $defaultFields = null)
    {
        if ($defaultFields !== null) {
            $this->fieldsDefault = $defaultFields;
        }

        parent::setModel($m, $this->fieldsRead ?: $this->fieldsDefault);
        $this->model->unload();

        if ($this->canCreate) {
            $this->initCreate();
        }

        if ($this->canUpdate) {
            $this->initUpdate();
        }

        if ($this->canDelete) {
            $this->initDelete();
        }

        return $this->model;
    }
public function setModel(\atk4\data\Model $m, $defaultFields = null)
    {
        if ($defaultFields !== null) {
            $this->fieldsDefault = $defaultFields;
        }

        parent::setModel($m, $this->fieldsRead ?: $this->fieldsDefault);
        $this->model->unload();

        if ($this->canCreate) {
            $this->initCreate();
        }

        if ($this->canUpdate) {
            $this->initUpdate();
        }

        if ($this->canDelete) {
            $this->initDelete();
        }

        return $this->model;
    }
public function setModel ( \ atk4 \ data \ Model $ m , $ defaultFields = null ) { if ( $ defaultFields !== null ) { $ this -> fieldsDefault = $ defaultFields ; } parent :: setModel ( $ m , $ this -> fieldsRead ? : $ this -> fieldsDefault ) ; $ this -> model -> unload ( ) ; if ( $ this -> canCreate ) { $ this -> initCreate ( ) ; } if ( $ this -> canUpdate ) { $ this -> initUpdate ( ) ; } if ( $ this -> canDelete ) { $ this -> initDelete ( ) ; } return $ this -> model ; }
Sets data model of CRUD.

@param \atk4\data\Model $m
@param array            $defaultFields

@return \atk4\data\Model
Sets data model of CRUD .