[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
I think symfony can't know what you want to display If you don't tell it... ;) Show me your schema.yml file (at least part with Empressas specification) On 4 ún, 16:09, wueb webmaster@gmail.com wrote: On 4 Fev, 14:52, Tom Ptacnik to...@tomor.cz wrote: 1 st problem try to do: protected function doUpdateObject($values) { print_r($values['id_empresa']); parent::doUpdateObject($values); } Thanks i will try. 2 nd I don't understand what are you trying to do. And what does mean they are both foreign keys from same fields? Probably you want to do something like: tr tdCreated by/td td?php echo $info_empresa-getCreatedBy()-getUsername() ?/ td tdUpdated by/td td?php echo $info_empresa-getUpdatedBy()-getUsername() ?/ td /tr I already try this and get always an error (Fatal error: Call to a member function getUsername() on a non-object) When i say that of foreign keys is because created_by and updated_by are related with id from table Users. Empresas: id created_by updated_by Users id username When i make $info_empresa-getUsers()-getUsername() how will symfony knows what related ID will get? The created or updated? -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.
[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
1 st problem try to do: protected function doUpdateObject($values) { print_r($values['id_empresa']); parent::doUpdateObject($values); } 2 nd I don't understand what are you trying to do. And what does mean they are both foreign keys from same fields? Probably you want to do something like: tr tdCreated by/td td?php echo $info_empresa-getCreatedBy()-getUsername() ?/ td tdUpdated by/td td?php echo $info_empresa-getUpdatedBy()-getUsername() ?/ td /tr ? On 2 ún, 18:48, wueb webmaster@gmail.com wrote: Hello Tom, $empresas had a array with values and descriptions to put on the select. But right now my major problem is the 2nd. Any idea? -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.
[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
On 4 Fev, 14:52, Tom Ptacnik to...@tomor.cz wrote: 1 st problem try to do: protected function doUpdateObject($values) { print_r($values['id_empresa']); parent::doUpdateObject($values); } Thanks i will try. 2 nd I don't understand what are you trying to do. And what does mean they are both foreign keys from same fields? Probably you want to do something like: tr tdCreated by/td td?php echo $info_empresa-getCreatedBy()-getUsername() ?/ td tdUpdated by/td td?php echo $info_empresa-getUpdatedBy()-getUsername() ?/ td /tr I already try this and get always an error (Fatal error: Call to a member function getUsername() on a non-object) When i say that of foreign keys is because created_by and updated_by are related with id from table Users. Empresas: id created_by updated_by Users id username When i make $info_empresa-getUsers()-getUsername() how will symfony knows what related ID will get? The created or updated? -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.
[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
On 4 Fev, 14:52, Tom Ptacnik to...@tomor.cz wrote: 1 st problem try to do: protected function doUpdateObject($values) { print_r($values['id_empresa']); parent::doUpdateObject($values); } Thanks i will try. 2 nd I don't understand what are you trying to do. And what does mean they are both foreign keys from same fields? Probably you want to do something like: tr tdCreated by/td td?php echo $info_empresa-getCreatedBy()-getUsername() ?/ td tdUpdated by/td td?php echo $info_empresa-getUpdatedBy()-getUsername() ?/ td /tr I already try this and get always an error (Fatal error: Call to a member function getUsername() on a non-object) When i say that of foreign keys is because created_by and updated_by are related with id from table Users. Empresas: id created_by updated_by Users id username When i make $info_empresa-getUsers()-getUsername() how will symfony knows what related ID will get? The created or updated? -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.
[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
Anyone please? :( -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.
[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
!! -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.
[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
What do you have in the $empresas variable? how your action code? On 1 ún, 18:53, wueb webmaster@gmail.com wrote: Hi. I'm having 2 problems and i though someone here could help me. 1st PROBLEM: I have a widget called id_empresa which is a sfWidgetFormChoice with multiple choices, like this: $this-widgetSchema['id_empresa'] = new sfWidgetFormChoice( array( 'choices' = $empresas, 'expanded' = false, 'multiple' = true ), array( 'size' = $size ) ); And when i submit the form where the widget is, i can't get any value from the select box even with all the options selected. It returns me always null. //form public function updateObject($values = null) { print_r($this-id_empresa); //output = null !! } -- 2nd PROBLEM In my template i have this: tr tdCreated by/td td?php echo $info_empresa-getCreatedBy() ?/td tdUpdated by/td td?php echo $info_empresa-getUpdatedBy() ?/td /tr My point is get something like : tr tdCreated by/td td?php echo $info_empresa-getUsers()-getUsername() ?/td tdUpdated by/td td?php echo $info_empresa-getUsers()-getUsername() ?/td /tr But they are both foreign keys from same fields, how does the symfony knows what Username get?? The CreatedBy and UpdatedBy are IDs and can be from different users. -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.
[symfony-users] Re: sfWidgetFormChoice and Foreign keys problems!
Hello Tom, $empresas had a array with values and descriptions to put on the select. But right now my major problem is the 2nd. Any idea? -- You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-us...@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.