Posts Tagged accountable
actAs: Accountable Doctrine Behaviour
Posted by PhazeonPhoenix in Symfony on June 8th, 2009
It was fairly easy to create a Signable behaviour and it was done within a couple days. I soon realized though that the behavior of the SoftDelete behaviour wasn’t quite what I wanted. It only adds a “deleted” boolean field to the DB. I also wanted to know who deleted it and what time it was deleted. I decided to expand SoftDelete and make it use a timestamp instead of a boolean. That part worked too.
The problem I soon ran into was with when I combined SoftDelete and Signable with it’s new preDelete hook. Seems since SoftDelete stops the preDelete event it doesn’t let the Signable code execute properly. I decided that the correct answer to the problem was to create a whole new behaviour which would combine not only SoftDelete and Signable but also Timestampable. I called it Accountable since it’s primary function is to keep record of who touched an object.
I did a manual test and so far it’s worked as planned. I’m not yet sure of the SoftDelete filters… I made a change to preDqlDelete and preDqlSelect and I’m not quite sure if it still works. Time will tell I’m sure. Once I’m more certain this code is solid I’ll give more information on it.
