Re: last created, last modified

2008-03-04 Thread Brad Beattie

Yeah, I see the same behaviour. The modified field is only updated if
it isn't already set in the model's data. Building a work-around with
beforeSave or beforeValidates won't work as model.php's save function
builds its created/modified/updated information before these
callbacks. Grr...

Suggestions?


On Jan 31, 5:49 am, Siegfried Hirsch [EMAIL PROTECTED]
wrote:
 Hello grigri,

 2008/1/31, grigri [EMAIL PROTECTED]:

  The fields 'modified', 'created' and 'updated' are managed internally
  within Model::save().

  It doesn't matter where you call it from, if you call Model::save()
  then those fields will work automagically.

  Note that calling Model::updateAll() will not update any fields other
  than the ones you specify.

Yes, this is managed by Cake itself.

Check:http://tempdocs.cakephp.org/#TOC62105

 Yes, I have checked that and as I understand the default value of the field in
 the database schema should have NULL.
 But I get the modfied field only updated, if I null the field before
 saving the data.

 I have looked through the sources of model.php and I am not sure, but
 I understand from the source, that the field value of modfied has to
 be null to get it updated through cake automagically. Is this
 intentionally. I thought it would be updated before
 (Checking beta 6311 of course and the current version in CVS)

 Can anybody verify this ?

 Siegfried

--~--~-~--~~~---~--~~
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: last created, last modified

2008-03-04 Thread Brad Beattie

Hrm. Found a solution. In your app_model.php, add a function as
follows:

function save($data = null, $validate = true, $fieldList = 
array())
{
unset($this-data[$this-alias]['modified']);
return parent::save($data, $validate, $fieldList);
}

That seems to solve the problem. No idea if this is the best practice
for achieving this goal, but it works. *shrug*


On Jan 31, 5:49 am, Siegfried Hirsch [EMAIL PROTECTED]
wrote:
 Hello grigri,

 2008/1/31, grigri [EMAIL PROTECTED]:

  The fields 'modified', 'created' and 'updated' are managed internally
  within Model::save().

  It doesn't matter where you call it from, if you call Model::save()
  then those fields will work automagically.

  Note that calling Model::updateAll() will not update any fields other
  than the ones you specify.

Yes, this is managed by Cake itself.

Check:http://tempdocs.cakephp.org/#TOC62105

 Yes, I have checked that and as I understand the default value of the field in
 the database schema should have NULL.
 But I get the modfied field only updated, if I null the field before
 saving the data.

 I have looked through the sources of model.php and I am not sure, but
 I understand from the source, that the field value of modfied has to
 be null to get it updated through cake automagically. Is this
 intentionally. I thought it would be updated before
 (Checking beta 6311 of course and the current version in CVS)

 Can anybody verify this ?

 Siegfried

--~--~-~--~~~---~--~~
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: last created, last modified

2008-01-31 Thread grigri

The fields 'modified', 'created' and 'updated' are managed internally
within Model::save().

It doesn't matter where you call it from, if you call Model::save()
then those fields will work automagically.

Note that calling Model::updateAll() will not update any fields other
than the ones you specify.

On Jan 31, 6:30 am, Siegfried Hirsch [EMAIL PROTECTED]
wrote:
 2008/1/31, manish [EMAIL PROTECTED]:

  Yes, this is managed by Cake itself.

  Check:http://tempdocs.cakephp.org/#TOC62105

 What about cake Shells? If I use $model-save() in a Shell, do they
 created and modified
 fields also get updated ?
 I have just the problem and it looks like they are not updated.

 Any ideas ?
 Siegfried
--~--~-~--~~~---~--~~
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: last created, last modified

2008-01-31 Thread Siegfried Hirsch

Hello grigri,

2008/1/31, grigri [EMAIL PROTECTED]:
 The fields 'modified', 'created' and 'updated' are managed internally
 within Model::save().

 It doesn't matter where you call it from, if you call Model::save()
 then those fields will work automagically.

 Note that calling Model::updateAll() will not update any fields other
 than the ones you specify.

   Yes, this is managed by Cake itself.
 
   Check:http://tempdocs.cakephp.org/#TOC62105

Yes, I have checked that and as I understand the default value of the field in
the database schema should have NULL.
But I get the modfied field only updated, if I null the field before
saving the data.

I have looked through the sources of model.php and I am not sure, but
I understand from the source, that the field value of modfied has to
be null to get it updated through cake automagically. Is this
intentionally. I thought it would be updated before
(Checking beta 6311 of course and the current version in CVS)

Can anybody verify this ?

Siegfried

--~--~-~--~~~---~--~~
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: last created, last modified

2008-01-30 Thread manish

Yes, this is managed by Cake itself.

Check: http://tempdocs.cakephp.org/#TOC62105


On Jan 31, 9:07 am, Raistlin Majere [EMAIL PROTECTED] wrote:
 I do not know how the last created date and the last modified date are
 passed to my database. I do not have a hidden created date input nor a
 hidden modified date input in my script! Is it a Cake Convention? I am
 looking at the Cake Convention chapter and nothing is written about
 it. How come I have a created field and a modified field in my
 database that work?
--~--~-~--~~~---~--~~
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: last created, last modified

2008-01-30 Thread Siegfried Hirsch

2008/1/31, manish [EMAIL PROTECTED]:

 Yes, this is managed by Cake itself.

 Check: http://tempdocs.cakephp.org/#TOC62105

What about cake Shells? If I use $model-save() in a Shell, do they
created and modified
fields also get updated ?
I have just the problem and it looks like they are not updated.

Any ideas ?
Siegfried

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---