本文整理汇总了PHP中app\models\Student::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::className方法的具体用法?PHP Student::className怎么用?PHP Student::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Student
的用法示例。
在下文中一共展示了Student::className方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionToggle
/**
* Toggles a binary field from the summary grid
* @param type $id
* @param type $attribute
* @return mixed ajax response
* @throws ForbiddenHttpException
*/
public function actionToggle($id, $attribute)
{
$accessParams = ['student' => Student::findOne($id)];
if (Yii::$app->user->can('updateStudent', $accessParams)) {
$action = new ToggleAction('toggle', $this, ['modelClass' => Student::className()]);
return $action->run($id, $attribute);
} else {
throw new ForbiddenHttpException(Yii::t('app', 'You are not authorized to perform this action.'));
}
}
示例2: getStudents
/**
* @return \yii\db\ActiveQuery
*/
public function getStudents()
{
return $this->hasMany(Student::className(), ['school_id' => 'id']);
}
示例3: getStudent
/**
* @return \yii\db\ActiveQuery
*/
public function getStudent()
{
return $this->hasOne(Student::className(), ['id' => 'student_id']);
}
示例4: getStudents
public function getStudents()
{
return $this->hasMany(Student::className(), ['id' => 'student_id'])->viaTable('teacher_student', ['teacher_id' => 'id']);
}
示例5: getStudents
/**
* @return \yii\db\ActiveQuery
*/
public function getStudents()
{
return $this->hasMany(Student::className(), ['id' => 'student_id'])->via('assignedRanks');
}
示例6: getUserStudent
public function getUserStudent()
{
return $this->hasOne(Student::className(), ['st_id' => 'usr_type_id']);
}
示例7: rules
/**
* @inheritdoc
*/
public function rules()
{
return [[['student_id', 'teacher_id'], 'required'], [['student_id', 'teacher_id'], 'integer'], ['student_id', 'exist', 'targetClass' => Student::className(), 'targetAttribute' => 'id', 'message' => 'Ученик с таким id не найден'], ['teacher_id', 'exist', 'targetClass' => Teacher::className(), 'targetAttribute' => 'id', 'message' => 'Учитель с таким id не найден']];
}