How would detailsAction()
have to be called in the example provided in the documentation for JMSPaymentCoreBundle?
It makes use of an order object, which in the function definition is passed as an argument.
public function detailsAction(Order $order)
{
$form = $this->getFormFactory()->create('jms_choose_payment_method', null, array(
'amount' => $order->getAmount(),
[...]
Am I right in assuming that the function can only work when passing an order object at the time it is being called? Are there any other ways of achieving this other than doing something like
return $this->forward('MyBundle:Payment:details', array(
'order' => $order,
));
Yes, you are right. The
detailsAction
requires anOrder
object in order to work. So, you will have to have one created by the time you get to this action, otherwise it will throw a 404 error (because the route without an order does not exists).You should create your own
Order
entity, which then you can persist to the database (once it's started, that is, the submitted form is correct).Good luck.