Re: help with 'updated' and 'created' fields: Do I need to manually unset these fields in the data array?
Quote: One thing I came across was the fact that the columns for created & updated should be of the type datetime and Null should be set to 'null' and not 'not null' Oops, forgot to mention that :-( On Aug 27, 4:21 pm, teknoid <[EMAIL PROTECTED]> wrote: > Makes sense that it works like that... > > how/where are you modifying the data if you are just doing a read()? > > On Aug 27, 5:02 am, "Marc Schuetze" <[EMAIL PROTECTED]> wrote: > > > According to the docs 'modified' and 'updated' are both ok. > > I tried this with 'modified' as well and it was the same result > > > When I do $this->create(array(.)) and that array doesn't contain > > an update field then everything is fine and cake sets the update field > > properly. > > However, when I do > > $this->read(null,$id) the model's data array will contain the update > > field and it seems like I'll then have to manually unset it if I want > > to update the time in the field. > > If I don't do that cake will not fill the update field with a new > > value but will use the value that is is the model's data array > > > On Wed, Aug 27, 2008 at 10:58 AM, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > > The automagic fields should be called created and modified (not > > > updated). You don't need to do anything else. > > > > On Aug 27, 8:29 am, MarcS <[EMAIL PROTECTED]> wrote: > > >> Hi, > > > >> I just noticed that my 'updated' field won't update when I update > > >> data. > > >> I tried around for a while and then noticed that it won't update when > > >> the 'update' field is included in the Model's data array. > > >> But when I load data using Model::read(null,$id) the date fields are > > >> obviously always included in the Model's data. Do I then need to > > >> always manually unset them before saving? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: help with 'updated' and 'created' fields: Do I need to manually unset these fields in the data array?
Makes sense that it works like that... how/where are you modifying the data if you are just doing a read()? On Aug 27, 5:02 am, "Marc Schuetze" <[EMAIL PROTECTED]> wrote: > According to the docs 'modified' and 'updated' are both ok. > I tried this with 'modified' as well and it was the same result > > When I do $this->create(array(.)) and that array doesn't contain > an update field then everything is fine and cake sets the update field > properly. > However, when I do > $this->read(null,$id) the model's data array will contain the update > field and it seems like I'll then have to manually unset it if I want > to update the time in the field. > If I don't do that cake will not fill the update field with a new > value but will use the value that is is the model's data array > > On Wed, Aug 27, 2008 at 10:58 AM, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > The automagic fields should be called created and modified (not > > updated). You don't need to do anything else. > > > On Aug 27, 8:29 am, MarcS <[EMAIL PROTECTED]> wrote: > >> Hi, > > >> I just noticed that my 'updated' field won't update when I update > >> data. > >> I tried around for a while and then noticed that it won't update when > >> the 'update' field is included in the Model's data array. > >> But when I load data using Model::read(null,$id) the date fields are > >> obviously always included in the Model's data. Do I then need to > >> always manually unset them before saving? > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: help with 'updated' and 'created' fields: Do I need to manually unset these fields in the data array?
One thing I came across was the fact that the columns for created & updated should be of the type datetime and Null should be set to 'null' and not 'not null' Hope this helps. Olav On Aug 27, 11:02 am, "Marc Schuetze" <[EMAIL PROTECTED]> wrote: > According to the docs 'modified' and 'updated' are both ok. > I tried this with 'modified' as well and it was the same result > > When I do $this->create(array(.)) and that array doesn't contain > an update field then everything is fine and cake sets the update field > properly. > However, when I do > $this->read(null,$id) the model's data array will contain the update > field and it seems like I'll then have to manually unset it if I want > to update the time in the field. > If I don't do that cake will not fill the update field with a new > value but will use the value that is is the model's data array > > On Wed, Aug 27, 2008 at 10:58 AM, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > The automagic fields should be called created and modified (not > > updated). You don't need to do anything else. > > > On Aug 27, 8:29 am, MarcS <[EMAIL PROTECTED]> wrote: > >> Hi, > > >> I just noticed that my 'updated' field won't update when I update > >> data. > >> I tried around for a while and then noticed that it won't update when > >> the 'update' field is included in the Model's data array. > >> But when I load data using Model::read(null,$id) the date fields are > >> obviously always included in the Model's data. Do I then need to > >> always manually unset them before saving? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: help with 'updated' and 'created' fields: Do I need to manually unset these fields in the data array?
According to the docs 'modified' and 'updated' are both ok. I tried this with 'modified' as well and it was the same result When I do $this->create(array(.)) and that array doesn't contain an update field then everything is fine and cake sets the update field properly. However, when I do $this->read(null,$id) the model's data array will contain the update field and it seems like I'll then have to manually unset it if I want to update the time in the field. If I don't do that cake will not fill the update field with a new value but will use the value that is is the model's data array On Wed, Aug 27, 2008 at 10:58 AM, RichardAtHome <[EMAIL PROTECTED]> wrote: > > The automagic fields should be called created and modified (not > updated). You don't need to do anything else. > > On Aug 27, 8:29 am, MarcS <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I just noticed that my 'updated' field won't update when I update >> data. >> I tried around for a while and then noticed that it won't update when >> the 'update' field is included in the Model's data array. >> But when I load data using Model::read(null,$id) the date fields are >> obviously always included in the Model's data. Do I then need to >> always manually unset them before saving? > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: help with 'updated' and 'created' fields: Do I need to manually unset these fields in the data array?
The automagic fields should be called created and modified (not updated). You don't need to do anything else. On Aug 27, 8:29 am, MarcS <[EMAIL PROTECTED]> wrote: > Hi, > > I just noticed that my 'updated' field won't update when I update > data. > I tried around for a while and then noticed that it won't update when > the 'update' field is included in the Model's data array. > But when I load data using Model::read(null,$id) the date fields are > obviously always included in the Model's data. Do I then need to > always manually unset them before saving? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---