I was use this solution for complicated routes:
<?php echo url_for('route_name', array("module" => "mymodule",
"action" => "myaction", "id" => (!$form->getObject()->isNew()) ? $form-
>getObject()->getId() : '' )) ?>
If route name already have predefined `module` and `action` then you
can not determine their in url_for statement.
Example:
in routes we have:
route_name1:
url: /save
param: { module: mymodule, action: save }
route_name2:
url: /another_update
param: { module: anothermodule, action: update }
<?php echo url_for((!$form->getObject()->isNew()) ? 'route_name1' :
'route_name2', array("id" => (!$form->getObject()->isNew()) ? ;form-
>getObject()->getId() : '' )) ?>
Cheers,
On Dec 2, 5:08 am, Adrien Mogenet <[email protected]> wrote:
> Basically generated forms look like :
>
> <form action="<?php echo url_for('mymodule/'.($form->getObject()->isNew()
> ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.
>
> $form->getObject()->getId() : '')) ?>"
>
> BUT because I'm using routes, I would like to use route to define my
> action="..." parameter.
>
> Can you share your experience with that issue ? How do you manage this
> part ?
>
> Do you write sthg like :
>
> <?php if (is new): ?>
> <?php url_for('@myroute_1') ?>
> <?php else: ?>
> <?php url_for('@myroute_2') ?>
> <?php endif; ?>
>
> ?
--
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en.