问题
I have this route:
category_set_representative_image:
url: /categoria-settare-immaggine-rappresentativa
param: { module: category_new, action: setRepresentativeImage }
class: sfDoctrineRoute
options: { model: Category, type: object }
and a link associated to this:
url_for('category_set_representative_image', array('sf_subject' => $category))
When I click the link I get:
sfError404Exception: Action "categoriasettareimmagginerappresentativa/index" does not exist.
Any idea?
EDIT after the answer of Flask:
This is my code, no problems if I call the same url_for()
out of javascript tags.
<script>
$.post('<?php echo url_for('category_set_representative_image', array('sf_subject' => $category)) ?>',
function(){
alert("fadsf");
}
);
</script>
sf 1.4
Javi
回答1:
for routes you will have to add "@" before the route: url_for('@category_set_representative_image', array('sf_subject' => $category))
do you have you the default route at the end of the routing.yml?
回答2:
Currently it isn't executing the rule above.
You probably have a more generic routing rule before this rule. (the default /:module/:action
rule?)
来源:https://stackoverflow.com/questions/6995530/symfony-question-about-routes-and-url-for