Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 33 |
| Supervisor | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
56.00 | |
0.00% |
0 / 33 |
| tableName | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| behaviors | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 5 |
|||
| rules | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 7 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 9 |
|||
| afterDelete | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getOrganizations | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getUser | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace common\models; | |
| use Yii; | |
| use yii\behaviors\TimestampBehavior; | |
| /** | |
| * This is the model class for table "{{%supervisor}}". | |
| * | |
| * @property integer $id | |
| * @property string $office_name | |
| * @property integer $created_at | |
| * @property integer $updated_at | |
| * @property integer $user_id | |
| * | |
| * @property Organization[] $organizations | |
| * @property User $user | |
| */ | |
| class Supervisor extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%supervisor}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| TimestampBehavior::className(), | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['office_name', 'user_id'], 'required'], | |
| [['user_id'], 'integer'], | |
| [['office_name'], 'string', 'max' => 255] | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'office_name' => Yii::t('app', 'Office name'), | |
| 'created_at' => Yii::t('app', 'Created at'), | |
| 'updated_at' => Yii::t('app', 'Updated at'), | |
| 'user_id' => Yii::t('app', 'User'), | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function afterDelete() | |
| { | |
| $this->user->delete(); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getOrganizations() | |
| { | |
| return $this->hasMany(Organization::className(), ['supervisor_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getUser() | |
| { | |
| return $this->hasOne(User::className(), ['id' => 'user_id']); | |
| } | |
| } |