On Wed, Dec 8, 2010 at 7:19 PM, FahDoos <[email protected]> wrote:
> Wow, this was a really descriptive and helpful writeup, but
> unfortunately the conversations modified timestamp doesn't get update,
> as seen here:
>
> [Conversation] => Array
> (
> [id] => 4cfe98f6-d44c-4722-93ac-70d9c458e2c9
> [user_id] => 4cfd90f8-ffbc-418c-bc96-68b0c458e2c9
> [messages_count] => 3
> [active] => 1
> [created] => 2010-12-07 15:28:38
> [modified] => 2010-12-07 15:28:38
Bummer. But it does make sense not to update modified when bumping the
counter. What you could do then is add an afterSave() callback in the
Message model to do it for you:
function afterSave($created)
{
if ($created) // only do this for new Messages
{
$this->Conversation->id =
$this->data[$this->alias]['conversation_id'];
$this->Conversation->saveField('modified', 'NOW()');
}
}
If you're using something other than MySQL you may need to use
something other than NOW().
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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