code/controller/model.php
protected function _fetchEntity(ControllerContext $context)
    {
        if(!$context->result instanceof ModelEntityInterface)
        {
            switch($context->action)
            {
                case 'add'   :
                    $context->setEntity($this->getModel()->create($context->request->data->toArray()));
                    break;

                case 'edit'  :
                case 'delete':
                    $context->setEntity($this->getModel()->fetch());
                    break;

            }

        }
        else $context->setEntity($context->result);
    }
protected function _fetchEntity(ControllerContext $context)
    {
        if(!$context->result instanceof ModelEntityInterface)
        {
            switch($context->action)
            {
                case 'add'   :
                    $context->setEntity($this->getModel()->create($context->request->data->toArray()));
                    break;

                case 'edit'  :
                case 'delete':
                    $context->setEntity($this->getModel()->fetch());
                    break;

            }

        }
        else $context->setEntity($context->result);
    }
protected function _fetchEntity ( ControllerContext $ context ) { if ( ! $ context -> result instanceof ModelEntityInterface ) { switch ( $ context -> action ) { case 'add' : $ context -> setEntity ( $ this -> getModel ( ) -> create ( $ context -> request -> data -> toArray ( ) ) ) ; break ; case 'edit' : case 'delete' : $ context -> setEntity ( $ this -> getModel ( ) -> fetch ( ) ) ; break ; } } else $ context -> setEntity ( $ context -> result ) ; }
Fetch the model entity

@param ControllerContextModel  $context A controller context object
@return void
Fetch the model entity