This extension logs with every created or updated row in your database who created and who updated it. This may interest you when working in a group of more people sharing same privileges.
So you can see who changed what record set and - in combination with the timestampable behavior - when.
components/behaviors or just components, it's on you.created_by and updated_by. Column type should be varchar(128)See the following code example:
public function behaviors() { return array( 'Blameable' => array( 'class'=>'application.components.behaviors.BlameableBehavior', ), ); }
If you want to define own column names, just add them in the behaviors method like this:
public function behaviors() { return array( 'Blameable' => array( 'class'=>'application.components.behaviors.BlameableBehavior', 'createdByColumn' => 'my_own_creator_column_name', 'updatedByColumn' => 'my_own_updater_column_name', ), ); }
PLEASE MENTION to change the class attribute to where you located this little behavior. So the above examples only work, if you created an extra behaviors folder in your components directory (as I did).
Total 2 comments
For most of my models that use a similar behavior, it's beneficial to also include dates/timestamps that go with createdby and updatedby...this is pretty much standard issue for most of my records....
A related but more involved solution is to log changes to activerecords with the following behavior:
http://www.yiiframework.com/doc/cookbook/9/
Leave a comment
Please login to leave your comment.