[symfony-users] Re: Save an embedded form that relies on the other form
Did either of you find a solution to how to make this work? On Feb 6, 6:25 am, Timmy m...@timothybowler.com wrote: I have two forms form 1 and form 2. Form 2 is embedded into form 1. On save form1 must be saved as a new row and therefore recieving a primary key, Afterwards this foreign key needs to be injected into form 2 before it can save. The only way i have figured out at the mo is after the form is valid. Instantiate the two models, populate them, add form2 model to form 1 model then save. Isn't there an easier way? Thanx --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] filter form not appearing in admin
Hi I am having problem with the display of the filter forms. I am unable to display them in the admin site. Any hints where should i look for the fix. Cheers Asher --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Symfony 1.0 batch could not access sfGuard Plugin model classes?
Hi, I'm having problem using sfGuardPlugin's model classes from a batch script. Are plugin's classes auto loaded for batch script? Example or error I'm getting: PHP Fatal error: Call to undefined method sfGuardUserPeer::retrievebyemail() in batch/generate-test-pools.php on line 39 Note: sfGuardUserPeer::retrievebyemail exists and used throughout the project, but I couldn't seem to be able to use it from that batch script. -- Blue Horn Ltd - System Development http://bluehorn.co.nz --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: filter form not appearing in admin
Paste your generator.yml code --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Symfony 1.0 batch could not access sfGuard Plugin model classes?
Never mind, it was something else ... false alarm On Sun, Mar 15, 2009 at 11:25 PM, Sid Bachtiar sid.bacht...@gmail.com wrote: Hi, I'm having problem using sfGuardPlugin's model classes from a batch script. Are plugin's classes auto loaded for batch script? Example or error I'm getting: PHP Fatal error: Call to undefined method sfGuardUserPeer::retrievebyemail() in batch/generate-test-pools.php on line 39 Note: sfGuardUserPeer::retrievebyemail exists and used throughout the project, but I couldn't seem to be able to use it from that batch script. -- Blue Horn Ltd - System Development http://bluehorn.co.nz -- Blue Horn Ltd - System Development http://bluehorn.co.nz --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Save an embedded form that relies on the other form
I'm doing something like this, and this is my solution: Let's say you have two forms, one is an sfGuardUser form (Form 1), the other is a Profile form (Form 2) (representing those two models). When a new user is created, a new profile must be also created that depends on that record (Profile depends on sfGuardUser): (this is sfGuardUserForm.class.php): $profileForm = new ProfileForm(); $profileForm-getObject()-setsfGuardUserId($this-getObject()); $this-embedForm('profile', $profileForm); You'll also want to unset the sfGuardUserId field: unset($profileForm ['sf_guard_user_id']); So, it's basically creating a ProfileForm, getting the object related to it, then telling symfony to set that object's sfUserGuardId to equal the sfGuardUser object that this class represents. Does that make sense? Hope this helps. I'm somewhat of a newb myself, so I may be telling you something that doesn't apply. Good luck! Justin On Feb 5, 4:25 pm, Timmy m...@timothybowler.com wrote: I have two forms form 1 and form 2. Form 2 is embedded into form 1. On save form1 must be saved as a new row and therefore recieving a primary key, Afterwards this foreign key needs to be injected into form 2 before it can save. The only way i have figured out at the mo is after the form is valid. Instantiate the two models, populate them, add form2 model to form 1 model then save. Isn't there an easier way? Thanx --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Generate fixture from database contents
I usually use symfony propel:data-dump fixture.yml. Then edit the file if i have to. On Mar 14, 2:59 am, Java Guy steve.san...@gmail.com wrote: Is there a task or method anyone knows of to generate a fixture from a plugin? I've got some initial data I've put into my database using a fixture? But some of it needs tweaking, and after tweaking, I'd like to regen the file. Tweaking it in the database makes life quite a bit simpler. If all else fails, I'll just write a script to do this. Thanks, Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] schema.sql is empty. Anybody can a help???
am following the tutorial for Jobeet/Doctrine on Day 3. After I created the schema.yml and run build-sql, the prompt is doctrine generating sql for models doctrine Generated SQL successfully for models But I cannot find mentioned sql file under data/sql. There is only one emply schema.sql residing. I am using Windows XAMPP distribution. Anybody can a help? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] saving multiple objects in a form save
Hello gentlemen, I have a propel form class in which i override the save() function. Am trying to save the main form object and some related objects. But when i try to use the id of the just-added main object i find it empty. It says in the docs. that once a propel object is saved the id should get set and can be retrieved by getId(). Also I see the main object being saved in the DB. Why does getId() return null? Is there any other way to implement this logic? thanks. Here is my code public function save($con = null) { try { $con-beginTransaction(); $this-object-save(); $con-commit(); $con-beginTransaction(); foreach($receivers as $reciever){ $msg_reciever = new MessageReciever(); if (sfConfig::get('sf_logging_enabled')) { sfContext::getInstance()-getLogger()-info(MsgId: . $this-object-getId()); } $msg_reciever-setMessageId($this-object-getId()); ... ... $msg_reciever-save(); } $con-commit(); } catch (Exception $e) { $con-rollBack(); throw $e; } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Generate fixture from database contents
I do same as maestro wrote, also you can specify the models you would like to get fixtures for, i.e: symfony propel:data-dump --classes=BlogPost,BlogComment frontend Thanks. maestro wrote: I usually use symfony propel:data-dump fixture.yml. Then edit the file if i have to. On Mar 14, 2:59 am, Java Guy steve.san...@gmail.com wrote: Is there a task or method anyone knows of to generate a fixture from a plugin? I've got some initial data I've put into my database using a fixture? But some of it needs tweaking, and after tweaking, I'd like to regen the file. Tweaking it in the database makes life quite a bit simpler. If all else fails, I'll just write a script to do this. Thanks, Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Generate fixture from database contents
Nice tip - I didn't know that feature existed Looks like the same works for Doctrine too :) I'll definitely be using that in future On 15 Mar 2009, at 18:04, Yevgeniy A. Viktorov wrote: I do same as maestro wrote, also you can specify the models you would like to get fixtures for, i.e: symfony propel:data-dump --classes=BlogPost,BlogComment frontend Thanks. maestro wrote: I usually use symfony propel:data-dump fixture.yml. Then edit the file if i have to. On Mar 14, 2:59 am, Java Guy steve.san...@gmail.com wrote: Is there a task or method anyone knows of to generate a fixture from a plugin? I've got some initial data I've put into my database using a fixture? But some of it needs tweaking, and after tweaking, I'd like to regen the file. Tweaking it in the database makes life quite a bit simpler. If all else fails, I'll just write a script to do this. Thanks, Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Save an embedded form that relies on the other form
I think that is basically same as what I have here. The ServerForm // ServerFormClass extends BaseServerForm public function configure() { // remove some fields from the form unset($this['created_at'], $this['updated_at'], $this ['server_key']); //if ($this-isNew()) //{ // unset($this['hardware_information']['server_id']); //} // end if $maintain_options = array( 'Y' = 'Yes', 'N' = 'No', ); $this-widgetSchema['maintain'] = new sfWidgetFormChoice (array('choices' = $maintain_options)); //$this-widgetSchema['contact_id'] = new sfWidgetFormInputHidden(); $this-widgetSchema['contact_id'] = new sfWidgetFormPropelChoice(array('model' = 'Contact', 'order_by' = array('Name', 'asc'), 'label' = 'Contact')); $this-widgetSchema['server_type_id'] = new sfWidgetFormPropelChoice(array('model' = 'ServerType', 'order_by' = array('Name', 'asc'), 'label' = 'Server Type', 'expanded' = true)); // 'default' = ServerTypePeer :: retrieveIdByName('server') //echo $this-getObject()-getInstallDate(Y); $years = range(date('Y') - 10, date('Y') + 15); //$server_info = $this-getObject()-getServer /* * check if the object is new */ if ($this-getObject()-isNew()) { $this-widgetSchema['install_date'] = new sfWidgetFormDate(array ('format' = '%day%/%month%/%year%', 'years' = array_combine($years, $years), 'empty_values' = array('year' = date(Y), 'month' = date ('m'), 'day' = date('d'; $this-widgetSchema['next_date']= new sfWidgetFormDate(array ('format' = '%day%/%month%/%year%', 'years' = array_combine($years, $years), 'empty_values' = array('year' = date('Y'), 'month' = date ('m'), 'day' = date('d'; // $this-widgetSchema['server_type_id']-setDefault (ServerTypePeer :: retrieveIdByName('server')); } else { $this-widgetSchema['install_date'] = new sfWidgetFormDate(array ('format' = '%day%/%month%/%year%', 'years' = array_combine($years, $years), 'empty_values' = array('year' = $this-getObject()- getInstallDate('Y'), 'month' = $this-getObject()-getInstallDate ('m'), 'day' = $this-getObject()-getInstallDate('d'; $this-widgetSchema['next_date'] = new sfWidgetFormDate(array ('format' = '%day%/%month%/%year%', 'years' = array_combine($years, $years), 'empty_values' = array('year' = $this-getObject()- getNextDate('Y'), 'month' = $this-getObject()-getNextDate('m'), 'day' = $this-getObject()-getNextDate('d'; } // end if else $this-widgetSchema-setLabels(array('notes' = 'Comments')); // only embed if there is a type object (edit vs create) if (!$this-getObject()-isNew()) { $this-embedForm('information', $this-getServerInfoObject()); // $this-embedForm('Hardware Information', new ServerInfoForm(ServerInfoPeer :: retrieveByServerId($this-getObject()- getId(; } else { $server_info_form = new ServerInfoForm(); $server_info_form-getObject()-setServerId($this-getObject()- getId()); $this-embedForm('Hardware Information', $server_info_form); unset($server_info_form['server_id']); } // unset($this['server_id']); } How ever when I then save this new server and new record I get the two records inserted and the server_id field within the server_info table is not getting the id (server.id) value from the server table added to it. I have spent so much time trying to work this out. All I want is when the new server record is created and the embbed server_info fields are submitted that the server_info record that is created then uses the newly created server.id field that should populate the server_id field of the server_info table It is the exact same principle as the user and user profile relationship. On Mar 16, 12:42 am, justin_davis jdavis1...@gmail.com wrote: I'm doing something like this, and this is my solution: Let's say you have two forms, one is an sfGuardUser form (Form 1), the other is a Profile form (Form 2) (representing those two models). When a new user is created, a new profile must be also created that depends on that record (Profile depends on sfGuardUser): (this is sfGuardUserForm.class.php): $profileForm = new ProfileForm(); $profileForm-getObject()-setsfGuardUserId($this-getObject()); $this-embedForm('profile', $profileForm); You'll also want to unset the sfGuardUserId field: unset($profileForm ['sf_guard_user_id']); So, it's basically creating a ProfileForm, getting the object related to it, then telling symfony to set that object's sfUserGuardId to equal the sfGuardUser object that this class represents. Does that make sense? Hope this helps. I'm somewhat of a newb myself, so I may be telling you something that doesn't apply. Good luck! Justin On Feb 5, 4:25 pm, Timmy m...@timothybowler.com wrote: I have two
[symfony-users] Pass values from one form to another
Hey all, I'm trying to create a multi-page signup form. The first page is a form that creates the user (sfGuardUser) and also creates a profile for them (table name: Profile). After that is submitted, it redirects to a second form, for the user to fill out more profile details. However, I don't know how to load the appropriate Profile object on this page. After I create it in the first form submission, how should I pass it to the second form, so the second form simply updates the profile? One thought I just had was to create the user, then after form submission, sign them in automatically then send them to the second form where I can then just use $this-getUser-getGuardUser()- getProfile() to get the corresponding profile object. Not sure if that's the best way or not. What do you all think? Thanks! Justin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---