Discussion:
[TYPO3-english] what is wrong with my $this->redirect(...) call in this code?
Calgacus map Brude
2014-02-04 22:13:12 UTC
Permalink
I have two extensions, I want to redirect from one to another in a certain action. This is my redirect code in the saveAction of my bpsmessagecontroller of my bpsmessagecentre extension:

$this->redirect('list', 'Coupon', 'Bpscoupons', array('message' => 'Look Ma, no syntax errors!' ));
When that runs it just redirects back to the list page of the calling extension (bpsmessagecenter), it doesn't seem to find the Bpscoupons extension at all.

When I try the same code with a forward call instead of redirect I get a 500 error.

The 'list' action is accessible and works from a link on the site and from some other redirects inside the bpscoupons extension.

Why won't that redirect work? Is there something about internal or external redirects I have to configure somewhere?

I am using typo3 4.5.32 . Thanks

PS, btw in my query string I see I get these params:

tx_bpscoupons_bpsmessagecentre[message]:Hi ma... etc
tx_bpscoupons_bpsmessagecentre[action]:list
tx_bpscoupons_bpsmessagecentre[controller]:Coupon
Looks to me like it is looking for a bpsmessagecentre object a bpscoupons object but I don't know.
Calgacus map Brude
2014-02-05 17:58:51 UTC
Permalink
was missing the pageid of the coupon page, including it and now I can hit the coupon list page but I can't hit the new page if I change the code like so :
$this->redirect( 'new',
'Coupon',
'Bpscoupons',
array(
$this->objectManager->create('Tx_BpsCoupons_Domain_Model_Coupon'),
'message' => 'Your Message was saved, after you create the new Coupon return to the message.',
'bpsmessageid' => $bPSMessage->getUid()
),
44
);

should I pass null for the new object? so far that doesn't work and when I pass as shown I get this error:
Oops, an error occured!

Could not serialize Domain Object Tx_BpsCoupons_Domain_Model_Coupon. It is neither an Entity with identity properties set, nor a Value Object.
Calgacus map Brude
2014-02-05 18:24:32 UTC
Permalink
ok one part of the problem is that I forgot to name the first variable:
'newCoupon' => null,
etc...
but it still ain't working with that fix.
Calgacus map Brude
2014-02-05 20:41:45 UTC
Permalink
ok, I had to add this line before my redirect.
$this->request->setPluginName('Bpscoupons');
now it works. not sure why that was necessary as the target extension was named in the redirect but ok.
Continue reading on narkive:
Loading...