2015年5月20日星期三

NetTuts.com: Programming With Yii2: Blameable Behaviors


NetTuts.com has continued their series about programming with the Yii2 framework with this new tutorial talking about blamable behaviors. These behaviors can de defined similarly to a common concept in other languages/tools, mixins



In this tutorial, I'll guide you through another of Yii2's interesting behaviors: helping automate the common web development task of assigning created by and updated by user_ids across the models in your web app using DRY coding and Yii2 BlameableBehavior. We'll also create a log that records who updated the Status table for every change made.


In his example he shows the code needed to insert and update these two dates related to users of your system. He shows what kind of updates are needed to support it in your migrations and adding in the support for the BlameableBehavior in the models. He then modifies this example to not only log the latest person to modify a record but a history of IDs in a "status log" table.


Link: http://code.tutsplus.com/tutorials/programming-with-yii2-blameable-behaviors--cms-23287

没有评论:

发表评论