当前位置: 首页>>代码示例>>PHP>>正文


PHP Person::className方法代码示例

本文整理汇总了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]);
     }
 }
开发者ID:slavam,项目名称:placement,代码行数:32,代码来源:FileController.php

示例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]);
 }
开发者ID:jcshep,项目名称:FrontRunner,代码行数:15,代码来源:Project.php

示例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]);
 }
开发者ID:mosedu,项目名称:confprof,代码行数:7,代码来源:Section.php

示例4: getPeople

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPeople()
 {
     return $this->hasMany(Person::className(), ['user_id' => 'id']);
 }
开发者ID:slavam,项目名称:placement,代码行数:7,代码来源:User.php

示例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']];
 }
开发者ID:slavam,项目名称:placement,代码行数:7,代码来源:Education.php

示例6: getPricipal

 public function getPricipal()
 {
     return $this->hasOne(Person::className(), ['id' => 'pricipal_id']);
 }
开发者ID:stknight43,项目名称:SHBB,代码行数:4,代码来源:Company.php

示例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]);
     });
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:6,代码来源:Vacancy.php

示例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']);
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:9,代码来源:Review.php

示例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]);
 }
开发者ID:mosedu,项目名称:confprof,代码行数:7,代码来源:Doclad.php

示例10: getDebtPerson

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDebtPerson()
 {
     return $this->hasOne(Person::className(), ['person_id' => 'debt_person']);
 }
开发者ID:serge-larin,项目名称:debt-test,代码行数:7,代码来源:Debt.php

示例11: getReserveStudent

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReserveStudent()
 {
     return $this->hasOne(Person::className(), ['person_id' => 'reserve_student_id']);
 }
开发者ID:boylee1111,项目名称:Reservation,代码行数:7,代码来源:Reserve.php

示例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' => ['?', '@']]]]];
 }
开发者ID:mosedu,项目名称:confprof,代码行数:4,代码来源:BaseConferenceController.php

示例13: getTransactionPerson

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTransactionPerson()
 {
     return $this->hasOne(Person::className(), ['person_id' => 'transaction_person_id']);
 }
开发者ID:boylee1111,项目名称:Reservation,代码行数:7,代码来源:Transaction.php

示例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]);
     });
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:11,代码来源:Course.php

示例15: getPerson

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPerson()
 {
     return $this->hasOne(Person::className(), ['id' => 'person_id']);
 }
开发者ID:slavam,项目名称:placement,代码行数:7,代码来源:DocRegistration.php


注:本文中的app\models\Person::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。