[TYPO3-mvc] Passing objects from view to controller - Typo3 6.2.9

Stephan Schuler Stephan.Schuler at netlogix.de
Mon Feb 16 13:16:52 CET 2015


Hey there.

You might have some other issues, too. But at a first glance, you have a slightly odd function definition.

Your very first argument, "$newForeignProductMeasuring", is optional and defaults to NULL if not present.
The second argument, "$planRow" is not optional.

Since the extbase request dispatcher does argument mapping for you anyway, the actual argument order doesn't matter much to you. So you could simply move the "$newForeignProductMeasuring" argument to the very end and thereby make the optional argument the last one.

I'm not saying this is forbidden in general. I'm a bit in a hurry and thus couldn't find any documentation about argument ordering and optional parts at all. But I know there were at least some issues with this.

Regards,


Stephan Schuler
Web-Entwickler | netlogix Media

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Web: media.netlogix.de




netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Neuwieder Straße 10 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Web: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von Axel Beckert
Gesendet: Samstag, 7. Februar 2015 10:14
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: [TYPO3-mvc] Passing objects from view to controller - Typo3 6.2.9

Dear All,

Sorry for writing in German before. So here is the problem again:
I faced the following problem in Typo3 6.2.9

When I pass some objects to the controller by using f:link action and arguments, the objects will arrive at the controller but he does not register them as they what I have send. For a better explanation here the single code sections:


at the partial:

<f:link.action action="new" controller="ForeignProductMeasuring" arguments="{planRow : planRow, plan:plan}">neue Dosierung anlegen</f:link.action>

the generated link in the site:

"index.php?id=1&tx_desinfektionsplan_desinfektionsplan%5BplanRow%5D=12&tx_desinfektionsplan_desinfektionsplan%5Bplan%5D=16&tx_desinfektionsplan_desinfektionsplan%5Baction%5D=new&tx_desinfektionsplan_desinfektionsplan%5Bcontroller%5D=ForeignProductMeasuring&cHash=2adafaba9c56b134d4d5ae382ee5d57b"

what shows the the arguments are correct in my opinion.

Here the action at the controller:

public function newAction(\Orochemie\Desinfektionsplan\Domain\Model\ForeignProductMeasuring $newForeignProductMeasuring = NULL, \Orochemie\Desinfektionsplan\Domain\Model\PlanRow $planRow, \Orochemie\Desinfektionsplan\Domain\Model\Plan $plan) {

\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $this->request->getArguments()); $this->view->assign('newForeignProductMeasuring', $newForeignProductMeasuring); $this->view->assign('planRow', $planRow); $this->view->assign('plan', $plan);

}

The error looks like this:

#1: PHP Catchable Fatal Error: Argument 2 passed to Orochemie\Desinfektionsplan\Controller\ForeignProductMeasuringController::newAction() must be an instance of Orochemie\Desinfektionsplan\Domain\Model\PlanRow, none given in /kunden/137629_70806/typo3/typo3conf/ext/desinfektionsplan/Classes/Controller/ForeignProductMeasuringController.php line 46

For me it looks like that he don´t knows the objects which he gets. But if I check the arguments with $this->request->getArguments() then I see that all arguments arrive at the controller.

Does anybody has a idea of what is the problem here?

Thanks in advance

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


More information about the TYPO3-project-typo3v4mvc mailing list