Thanks, Frank. I haven't tested it, but that exactly the kind of thing I 
was looking for.

Cheers,

Tom

Frank Stelzer wrote:
> Hi,
> overwrite the "setValue" method and save the old value there:
> 
> public function setValue($v)
> {
>    $this->setOldValue($this->getValue());
>    parent::setValue($v);
> }
> 
> Frank
> 
> Am 09.07.2009 um 15:53 schrieb Tom Haskins-Vaughan:
> 
>> They way I have it set up at the moment, is overriding the save()  
>> method
>> of the model class. It works fine, I create a log entry with the new
>> value. But what I want to include is the value of the db record before
>> it was updated so that I can have in the log something like:
>>
>> DATE | USER | FIELD | OLD_VALUE | NEW_VALUE
>>
>> So I need a method like $object->getOldValue() or
>> $object->getValueBeforeUpdate()
>>
>> Steve the Canuck wrote:
>>> The best way to do this is create an audit table and write a simple
>>> trigger to insert records on each change
>>>
>>> If you want to do it programmatically you can create a behavior.
>>>
>>> Steve
>>> On Jul 9, 9:14 am, Tom Haskins-Vaughan <t...@templestreetmedia.com>
>>> wrote:
>>>> sf1.2 doctrine
>>>>
>>>> Hi,
>>>>
>>>> I'm trying to create a change log for a table and I was wondering if
>>>> there was a way to get the values of a record before they were  
>>>> modified
>>>> so that I could add them to the log:
>>>>
>>>> in the save method:
>>>>
>>>> $log = new Log()
>>>>
>>>> $log->old_value = $this->getOldValue();
>>>> $log->new_value = $this->value;
>>>>
>>>> $log->save();
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks.
>>>>
>>>> Tom
>>>>
> 
> 
> > 
> 

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

Reply via email to