本文整理汇总了PHP中app\models\Person::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::className方法的具体用法?PHP Person::className怎么用?PHP Person::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Person
的用法示例。
在下文中一共展示了Person::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new File model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new File();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$dir = Yii::getAlias('@app/uf');
foreach (UploadedFile::getInstances($model, 'files') as $file) {
$file->saveAs($dir . '/' . $file->baseName . '.' . $file->extension);
$new_file = new File();
$new_file->setAttributes($model->attributes);
$new_file->file_name = $file->baseName . '.' . $file->extension;
$new_file->file_path = $dir . '/' . $file->baseName . '.' . $file->extension;
$new_file->table_name = 'person';
$new_file->class_name = Person::className();
$new_file->save();
}
Yii::$app->getSession()->addFlash('success', "Запись \"{$model->id}\" успешно добавлена.");
return $this->redirect(Url::previous() != Yii::$app->homeUrl ? Url::previous() : ['view', 'id' => $model->id]);
} else {
if (Yii::$app->request->referrer != Yii::$app->request->absoluteUrl) {
Url::remember(Yii::$app->request->referrer ? Yii::$app->request->referrer : null);
}
if (!Yii::$app->request->isPost) {
$model->setAttributes(Yii::$app->request->get());
}
return $this->render('create', ['model' => $model]);
}
}
示例2: getPeople
public function getPeople($list, $segment = NULL, $role = NULL)
{
return $this->hasMany(Person::className(), ['id' => 'user_id'])->joinWith(['list'])->viaTable('person_project', ['project_id' => 'id'], function ($query) use($list, $segment, $role) {
$conditions = ['list' => $list];
// Apply segment
if ($segment) {
$conditions['availability'] = $segment;
}
// Apply role
if ($role) {
$conditions['role'] = $role;
}
$query->onCondition($conditions);
})->orderBy(['person_project.availability' => SORT_DESC]);
}
示例3: getGuests
/**
* @return \yii\db\ActiveQuery
*/
public function getGuests()
{
return $this->hasMany(Person::className(), ['prs_sec_id' => 'sec_id'])->where(['prs_active' => Person::PERSON_STATE_ACTIVE, 'prs_type' => Person::PERSON_TYPE_GUEST]);
}
示例4: getPeople
/**
* @return \yii\db\ActiveQuery
*/
public function getPeople()
{
return $this->hasMany(Person::className(), ['user_id' => 'id']);
}
示例5: rules
/**
* @inheritdoc
*/
public function rules()
{
return [[['type_id', 'person_id', 'education_type_id', 'profession_id', 'city_id', 'duration', 'rec_status_id', 'user_id'], 'integer'], [['date_start', 'date_end'], 'date', 'format' => 'dd.mm.yyyy'], [['education_type_id', 'person_id', 'firm', 'profession_id'], 'required'], [['firm'], 'string', 'max' => 128], [['type_id'], 'default', 'value' => 1], [['rec_status_id'], 'default', 'value' => 1], [['user_id'], 'default', 'value' => Yii::$app->user->id], [['note'], 'string'], [['dc'], 'safe'], ['person_id', 'exist', 'targetClass' => Person::className(), 'targetAttribute' => 'id']];
}
示例6: getPricipal
public function getPricipal()
{
return $this->hasOne(Person::className(), ['id' => 'pricipal_id']);
}
示例7: getOwners
public function getOwners()
{
return $this->hasMany(Person::className(), ['id' => 'person_id'])->viaTable('person_vacancy_role', ['vacancy_id' => 'id'], function ($query) {
$query->onCondition(['role_id' => VacancyRoleHelper::OWNER]);
});
}
示例8: getReceiver
/**
* Returns the receiving Person of this Review
*
* @return \yii\db\ActiveQuery Person
*/
public function getReceiver()
{
return $this->hasOne(Person::className(), ['receiver_id' => 'id']);
}
示例9: getPersons
/**
* @return \yii\db\ActiveQuery
*/
public function getPersons()
{
return $this->hasMany(Person::className(), ['prs_doc_id' => 'doc_id'])->where(['prs_type' => Person::PERSON_TYPE_CONSULTANT]);
}
示例10: getDebtPerson
/**
* @return \yii\db\ActiveQuery
*/
public function getDebtPerson()
{
return $this->hasOne(Person::className(), ['person_id' => 'debt_person']);
}
示例11: getReserveStudent
/**
* @return \yii\db\ActiveQuery
*/
public function getReserveStudent()
{
return $this->hasOne(Person::className(), ['person_id' => 'reserve_student_id']);
}
示例12: behaviors
public function behaviors()
{
return ['validateConsultant' => ['class' => MultirowsBehavior::className(), 'model' => Person::className(), 'defaultattributes' => ['prs_type' => Person::PERSON_TYPE_CONSULTANT], 'scenario' => 'createconsultant'], 'validateMedals' => ['class' => MultirowsBehavior::className(), 'model' => Docmedal::className()], 'validateMembers' => ['class' => MultirowsBehavior::className(), 'model' => Member::className()], 'access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'actions' => ['list', 'create', 'view', 'update', 'logout', 'delete', 'deletefile'], 'roles' => ['@']], ['allow' => true, 'actions' => ['index', 'register', 'calendar', 'guest', 'login'], 'roles' => ['?', '@']], ['allow' => true, 'actions' => ['regthankyou', 'confirm'], 'roles' => ['?', '@']]]]];
}
示例13: getTransactionPerson
/**
* @return \yii\db\ActiveQuery
*/
public function getTransactionPerson()
{
return $this->hasOne(Person::className(), ['person_id' => 'transaction_person_id']);
}
示例14: getStudentAssistants
/**
* Returns all studentAssistants for this course
*
* @return \yii\db\ActiveQuery Person
*/
public function getStudentAssistants()
{
return $this->hasMany(Person::className(), ['id' => 'person_id'])->viaTable('person_course_role', ['course_id' => 'id'], function ($query) {
$query->onCondition(['role_id' => CourseRoleHelper::STUDENTASSISTANT]);
});
}
示例15: getPerson
/**
* @return \yii\db\ActiveQuery
*/
public function getPerson()
{
return $this->hasOne(Person::className(), ['id' => 'person_id']);
}