Bug #29582

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

Added by Fernando Arconada about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Must have
Category:
Property
Target version:
-
Start date:
2011-09-09
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

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

#1

Updated by Karsten Dambekalns about 9 years ago

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

Updated by Karsten Dambekalns about 9 years 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!

#3

Updated by Fernando Arconada about 9 years 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);
    }
}
#4

Updated by Karsten Dambekalns about 9 years 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.

#5

Updated by Fernando Arconada about 9 years 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

#6

Updated by Bastian Waidelich about 9 years 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

#7

Updated by Fernando Arconada about 9 years 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

#9

Updated by Christian Müller over 8 years ago

  • Has patch set to No

The interesting question is, how is this being called?

#10

Updated by Fernando Arconada over 8 years 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

#11

Updated by Christian Müller over 8 years ago

  • Status changed from Needs Feedback to Closed

Also available in: Atom PDF