On giovedì 28 aprile 2011 at 01.27, JP wrote:
Hi everyone,
> 
> I'm facing some issues after insert a "Patient" with a form generated with 
> php symfony doctrine:generate-admin backend Patient --module=patient task. 
> The form is inserting the data into a mysql DB correctly, but after the 
> insert the default behavior is to redirect to the edit page( 
> http://localhost/appaname/module/objectid/edit ), and here is where I getting 
> the error:
> 
> Fatal error: Call to undefined method sfRoute::getObject() in 
> C:\sfworkspace\MedSched\cache\backend\dev\modules\autoPatient\actions\actions.class.php
>  on line 93 
You are getting this error because due to missing parameter symfony is matching 
wrong routing rule (as you can see from log) 
> Looking to the URL bar I realize that the Patient id is missing! I being 
> redirected to http://medsched.localhost:8080/backend_dev.php/patient//edit ,  
> look between patient and edit: there is no id.
> 
> This is the log fragment when clicking the "Save" button (red highlight to 
> suspicious behaviors, at least for myself):
> 
> Apr 25 20:22:57 symfony [info] {sfPatternRouting} Match route 
> "patient_create" (/patient.:sf_format) for /patient with parameters array (  
> 'module' => 'patient',  'action' => 'create',  'sf_format' => 'html',)
> Apr 25 20:22:57 symfony [info] {sfFilterChain} Executing filter 
> "sfRenderingFilter"
> Apr 25 20:22:57 symfony [info] {sfFilterChain} Executing filter 
> "sfExecutionFilter"
> Apr 25 20:22:57 symfony [info] {patientActions} Call 
> "patientActions->executeCreate()"
> Apr 25 20:22:57 symfony [info] {Doctrine_Connection_Mysql} exec : SET NAMES 
> 'UTF8' - ()
> Apr 25 20:22:57 symfony [info] {Doctrine_Connection_Statement} execute : 
> INSERT INTO patient (dni, name, lastname, email, celnumber, phonenumber, 
> firsttime, medicalservicenumber, medical_service_id) VALUES (?, ?, ?, ?, ?, 
> ?, ?, ?, ?) - (9898989898, 8888, 8, 8, 8, 8, 0, 888, 2)
> Apr 25 20:22:57 symfony [info] {Doctrine_Connection_Statement} execute : 
> SELECT p.id AS p__id, p.dni AS p__dni, p.name AS p__name, p.lastname AS 
> p__lastname, p.email AS p__email, p.celnumber AS p__celnumber, p.phonenumber 
> AS p__phonenumber, p.firsttime AS p__firsttime, p.medicalservicenumber AS 
> p__medicalservicenumber, p.medical_service_id AS p__medical_service_id FROM 
> patient p WHERE (p.id = ? AND p.medical_service_id = ?) LIMIT 1 - (, 2)
Note the missing value for first parameters (p.id) for this query. This is 
really strange, after the insert doctrine does not seem able to retrieve 
inserted id (I really can't figure out why).
> Apr 25 20:22:57 symfony [info] {sfFrontWebController} Redirect to 
> "http://medsched.localhost:8080/backend_dev.php/patient//edit";
> Apr 25 20:22:57 symfony [info] {sfWebResponse} Send status "HTTP/1.1 302 
> Found" --> down this message I put the meaning of this error code
> Apr 25 20:22:57 symfony [info] {sfWebResponse} Send header "Location: 
> http://medsched.localhost:8080/backend_dev.php/patient//edit"-->between 
> patient and edit: missing id
> Apr 25 20:22:57 symfony [info] {sfWebResponse} Send header "Content-Type: 
> text/html; charset=utf-8"
> Apr 25 20:22:57 symfony [info] {sfWebDebugLogger} Configuration 14.21 ms (10)
> Apr 25 20:22:57 symfony [info] {sfWebDebugLogger} Factories 53.85 ms (1)
> Apr 25 20:22:57 symfony [info] {sfWebDebugLogger} Action "patient/create" 
> 137.32 ms (1)
> Apr 25 20:22:57 symfony [info] {sfWebDebugLogger} Database (Doctrine) 0.03 ms 
> (3)
> Apr 25 20:22:57 symfony [info] {sfWebResponse} Send content (131 o)
> Apr 25 20:22:57 symfony [info] {sfPatternRouting} Match route "default" 
> (/:module/:action/*) for /patient/edit with parameters array (  'module' => 
> 'patient',  'action' => 'edit',)
Without id in route symfony match "default" route that has no "getObject" 
parameter. 
> HTTP 1.1 302 Error:
> ErrorDocument Found | Sample 302 Found
> This is the most popular redirect code[citation needed], but also an example 
> of industrial practice contradicting the standard. HTTP/1.0 specification 
> (RFC 1945 ) required the client to perform a temporary redirect (the original 
> describing phrase was "Moved Temporarily"), but popular browsers implemented 
> it as a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307 to 
> disambiguate between the two behaviours. However, the majority of Web 
> applications and frameworks still use the 302 status code as if it were the 
> 303.
> 
> Early thoughts, according to my analysis:
> 1) Given the 302 error in the log, I suspect that is something wrong (bad 
> configuration) in my mod_rewrite. The only mod_rewrite conf in my project is:
> 
302 is a standard behavior, after form->save() action will redirect to edit 
page and will send a 302. 
> 
> 2) Something wrong with my routing.yml:
> 
[cut] 
This was my first idea... but I can't see any error in your routing file. 
> 
> 3) Something wrong with the generate-admin task (but I generated a module 
> named Doctor, and everything is working just fine)
> 
> Just for the record, all the others actions are working fine: index, edit 
> (when is called from the index action), delete, the filters.
This excludes the possibility of 2 and 3 (i think).
Did you customize any part of module ? action ? form ? If so can you post it ? 
Can you post your generator.yml 
It's a really strange issue...

Francesco

---
Francesco Tassi 
More about me http://flavors.me/ftassi


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to