rlandster
rlandster

Reputation: 7825

Update one attribute of a Symfony doctrine object when another changes

In a symfony 1.4 project I have Doctrine object book that has a number of attributes including owner and owner_updated_at. I would like to have the field owner_updated_at set to the current date and time any time the value of owner is changed. How can I do this?

Upvotes: 0

Views: 278

Answers (2)

samura
samura

Reputation: 4395

In your schema.yml:

Book:
  actAs:
    Timestampable: ~ # for time
    Signable: ~ # for owners

Upvotes: 0

greg0ire
greg0ire

Reputation: 23255

Use the Timestampable behavior, it is its purpose.

Upvotes: 1

Related Questions