Bug #29582

you should be able to pass any kind of objects to action methods

Added by Fernando Arconada over 1 year ago. Updated about 1 year ago.

Status:Closed Start date:2011-09-09
Priority:Must have Due date:
Assignee:Karsten Dambekalns % Done:

0%

Category:Property
Target version:-
PHP Version: Complexity:
Has patch:No FLOW3 version affected:FLOW3 1.0.0
Votes: 0

Description

if you try to pass an object not related to persistence manager to an actionmethod you will get an exeption:
Uncaught Exception in FLOW3
#1302628242: The given object is unknown to the Persistence Manager

This this wrong, for example if you want to implement an exception handler that would be called by other method and not from a web request. In general is wrong to think that all action will be called by a web request

History

Updated by Karsten Dambekalns over 1 year ago

  • Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow

Updated by Karsten Dambekalns over 1 year ago

  • Category set to Property
  • Status changed from New to Needs Feedback
  • Assignee set to Karsten Dambekalns

Could you provide the signature of the action method and what kind of object you want to pass to it? Thanks!

Updated by Fernando Arconada over 1 year ago

class AbstractController extends ActionController {
    public function processRequest(\TYPO3\FLOW3\MVC\RequestInterface $request, \TYPO3\FLOW3\MVC\ResponseInterface $response) {
        try {
            parent::processRequest($request, $response);
        } catch (CustomException $exception) {
            $this->redirect('exceptionHandler','Standard',NULL,array('exception'=>$exception));
        }
    }
}

class StandardController extends AbstractController {
    /**
     * @param /Enterprise.CustomPackage/Exceptions/CustomException $exception
     * @return void
     */
    public function exceptionHandlerAction($exception) {
        $this->view->assign('exception',$exception);
    }
}

Updated by Karsten Dambekalns over 1 year ago

Fernando Arconada wrote:

param /Enterprise.CustomPackage/Exceptions/CustomException $exception

If that is really what you have there, try with backslashes and the real namespace (no dot, that is). I'll give it a look next week, though.

Updated by Fernando Arconada over 1 year ago

sorry, the slashes were ok in my code but not in the issue. Really, cause this issue is blocking me i had to pass only the exception message (string) as a parameter to continue coding

Updated by Bastian Waidelich over 1 year ago

Fernando Arconada wrote:

sorry, the slashes were ok in my code but not in the issue.

I'm pretty sure I have successfully used arbitrary objects as action parameters.
Your code should look like this:

class StandardController extends AbstractController {

    /**
     * @param \Enterprise\CustomPackage\Exceptions\CustomException $exception
     * @return void
     */
    public function exceptionHandlerAction(\Enterprise\CustomPackage\Exceptions\CustomException $exception) {
        $this->view->assign('exception',$exception);
    }
}

HTH

Updated by Fernando Arconada over 1 year ago

     /**
     * @param \F2\SLists\Exception\SListsException $exception
     * @return void
     */
    public function exceptionHandlerAction(\F2\SLists\Exception\SListsException $exception){
        $this->view->assign('exception',$exception);
    }

and it doesnt works

I fired and UserException that extends SListsException

Updated by Karsten Dambekalns over 1 year ago

  • FLOW3 version affected set to FLOW3 1.0.0

Updated by Christian Mueller about 1 year ago

  • Has patch set to No

The interesting question is, how is this being called?

Updated by Fernando Arconada about 1 year ago

seems easier in java, in php may be with apc then if it is attached to apc is not a good idea to have inside the framework and you should cose the ticket

Updated by Christian Mueller about 1 year ago

  • Status changed from Needs Feedback to Closed

Also available in: Atom PDF