1
votes

I'm kinda new to TYPO3 and created one of my first extensions. Currently I'm having a Domain Model for a Product. I would like to do list- and show-Action for this model. However, when I'm generating the link to the show action with the f:link.action viewhelper, and use the link, TYPO3 seems to get into an endless-loop, but inside of my showAction, there is no loop. Now I've tried to get a debug output with the product inside. In case an Exception is thrown, I can see that the product-parameter is passed correctly (full data is inside).

Has anyone an idea what this could be?

Currently im using TYPO3 8.7.6

generated link looks like

http://my_ext.io/de/products/category/?tx_myextension_product%5Bproduct%5D=3&tx_myextension_product%5Baction%5D=show&tx_myextension_product%5Bcontroller%5D=Product&cHash=cd1717c3d94a3aaa3d7c4a91be34e839

it ends with an runtime error

the showAction looks like this

/**
 * @param \MyVendor\Myextension\Domain\Model\Product $product
 */
public function showAction($product){
    $this->view->assign('product', $product);

}

'code' in Fluid

<f:link.action action="show" arguments="{product: product}">
  {product.title} </f:link.action>

Thank you :)

2
It looks all correct. I would suggest you can look if all arguments are fetched right by using initializeShowAction() which runs before your showAction. Otherwise I would look for error handling settings and typos. - Thomas Löffler
Another cause of a loop may be a circular of recursive entity model. Care to post your Classes/Domain/Model/Product.php ? - j4k3

2 Answers

1
votes

You can get as object in show action.because you set parameter for object domain model.So you also need to parameter with the show action.like,

/**
 * action show
 * @param \MyVendor\Myextension\Domain\Model\Product $product
 * @return void
 */
public function showAction(\MyVendor\Myextension\Domain\Model\Product $product){
    $this->view->assign('product', $product);

}

in Fluid template you can passed arguments,

<f:link.action action="show" arguments="{product: product}">
  {product.title} </f:link.action>

If it is successfully worked,in your show.html file, you can get product object.

You can also debug : <f:debug>{product}</debug>.

0
votes

One possible reason for a loop might be that you've referenced a partial-template in a partial-template itself. For example like this:

File: /your_extension/Resources/Private/Partials/Product.html

<h2>{product.title}</h2>
<f:render partial="Product" arguments="{product: product}"/>

The same fault is possible on another level too, i.e. you include layout in partial as well as in template (it's done always in templates only) or you reference a section in itself.

In other words the fault might be found in your fluid-templates if my assumption is right.