What action is my Symfony/Doctrine generated form actually going to?
In my Symfony 1.4 project I am using the doctrine:generate-admin
task to create the modules that compose my backend system. One such module is "journeys". When I view the source of the "journeys/new" page (which displays the form to create a new journey entity) the action of the form is simply "journeys" (I expected it to be "journeys/create"). The "journeys" route on its own would call the开发者_运维知识库 executeIndex
method - however I put a log call in there and upon form submission, the log is not made. So this leads me to believe that executeIndex
is NOT being called, and another piece of code is being fired upon form submission that then (depending on a hidden input in the form) calls either executeCreate()
or executeUpdate()
. Problem is, I don't know where that would be happening. Any insight would be much appreciated.
I don't if this is relevant, but here is the routing definition for the journeys module
journey:
class: sfDoctrineRouteCollection
options:
model: journey
module: journeys
prefix_path: /journeys
column: id
with_wildcard_routes: true
Thanks!
When you look at the routes for your journey module (for example using php symfony app:routes frontend
), you would see that there are 2 actions mapped to the same pattern, but with a different method:
journey GET /journey.:sf_format
journey_create POST /journey.:sf_format
This means that when you do a GET request to /journey the index action is executes, and when you do a POST request the create action is executed.
I think it is routed to create
action. But you can see the routes that are generated via, e.g.
php symfony app:routes frontend
You should be able to see which HTTP method maps to which route.
精彩评论