Specifying save fields
I am trying to save some data using $this-Model-save($this-data, false, array('title', 'desc', 'RelatedModel.id')) Model belongsTo RelatedModel $this-data is formatted: array( 'Model' = array( 'title' = 'some data', 'desc' = 'some more data' ), 'RelatedModel' = array( 'id' = 'properly formatted id' ) ) The problem I am having is both the title and desc fields are saving properly but it is not filling in the RelatedModel's id into the related_model_id field --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Specifying save fields
If you are saving relations, you use saveAll(). http://book.cakephp.org/view/75/Saving-Your-Data If not, change RelationModel.id to relation_model_id. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Specifying save fields
I tried the underscored notation, but I will try saveAll(), thanks. On Jun 7, 6:49 pm, Miles J mileswjohn...@gmail.com wrote: If you are saving relations, you use saveAll(). http://book.cakephp.org/view/75/Saving-Your-Data If not, change RelationModel.id to relation_model_id. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Save fields
Are table rows in the user_systems and users tables named the same? If so, I would rename the rows in the users table so that they differ from user_systems and retry. On Apr 30, 9:46 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Question about selecting fields allowed to have data saved to with a HABTM save. I have a users_systems table which has id, user_id, system_id and a form to update the users systems only...no other data. Now I do not want a User attempting to edit the form and edit other data thats saved in the database by adding a data[User][group_id] text field or anything. The code below i added which gets a list of the tables in the database i am going to be saving to, in this case its the users_systems table. So i debug and sure enough i see the 3 fields id, user_id, system_id. Are the fields in the save() function in addition to the User-$join_table or if you leave it blank only fields in the User-$join_table-can be saved to? Basically I want to restrict data being saved exclusively to the fields in the User-$join_table and no where else. But its still saving data to the User table when I add a text field using firebug to the database. How can I only allow data to be saved to the fields in the users_systems table? Using AJAX so Security Component is of no use I guess. // this seems to do nothing as i can save other fields by adding a text field manually with firebug to save user entered data. $whitelist = array('system_id'); debug(array_intersect(array_keys($this-User-$join_table-schema()), $whitelist)); $this-User-save($this-data, true, array_intersect(array_keys($this-User-$join_table-schema()), $whitelist)); Ideas? Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Save fields
Question about selecting fields allowed to have data saved to with a HABTM save. I have a users_systems table which has id, user_id, system_id and a form to update the users systems only...no other data. Now I do not want a User attempting to edit the form and edit other data thats saved in the database by adding a data[User][group_id] text field or anything. The code below i added which gets a list of the tables in the database i am going to be saving to, in this case its the users_systems table. So i debug and sure enough i see the 3 fields id, user_id, system_id. Are the fields in the save() function in addition to the User-$join_table or if you leave it blank only fields in the User-$join_table-can be saved to? Basically I want to restrict data being saved exclusively to the fields in the User-$join_table and no where else. But its still saving data to the User table when I add a text field using firebug to the database. How can I only allow data to be saved to the fields in the users_systems table? Using AJAX so Security Component is of no use I guess. // this seems to do nothing as i can save other fields by adding a text field manually with firebug to save user entered data. $whitelist = array('system_id'); debug(array_intersect(array_keys($this-User-$join_table-schema()), $whitelist)); $this-User-save($this-data, true, array_intersect(array_keys($this-User-$join_table-schema()), $whitelist)); Ideas? Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: save fields but don't change MODIFIED filed
So, no one knows? Is it possible? Thanks. On 30 апр, 10:51, Sergei [EMAIL PROTECTED] wrote: Hello, Is there a way to save some fields to a record but don't change modified field? Using latest stable CakePHP. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: save fields but don't change MODIFIED filed
If you have the modified set to the existing value in your data, I don't think it sets it automatically. so something like $Item = $this-ModelName-read('modified',$id); $this-data['ModelName']['modified'] = $Item['ModelName']['modified']; $this-ModelName-id = $id; $this-ModelName-save($this-data); might work, or at least give you something to try On 4/30/07, Sergei [EMAIL PROTECTED] wrote: So, no one knows? Is it possible? Thanks. On 30 апр, 10:51, Sergei [EMAIL PROTECTED] wrote: Hello, Is there a way to save some fields to a record but don't change modified field? Using latest stable CakePHP. Thank you. -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: save fields but don't change MODIFIED filed
On Apr 30, 2007, at 8:38 PM, Sergei wrote: So, no one knows? Is it possible? $this-ModelName-execute(UPDATE `model_names` SET `field` = '$value' WHERE `model_names.id` = $id); -- J --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: save fields but don't change MODIFIED filed
OK, thank you. On 1 май, 11:54, Samuel DeVore [EMAIL PROTECTED] wrote: If you have the modified set to the existing value in your data, I don't think it sets it automatically. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
save fields but don't change MODIFIED filed
Hello, Is there a way to save some fields to a record but don't change modified field? Using latest stable CakePHP. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---