예제 #1
0
 public static function add($username, $password, $org_id)
 {
     $supervisor = new Users();
     $supervisor->social_role = self::SOCIAL_ROLE;
     $supervisor->username = $username;
     $supervisor->password = $password;
     $supervisor->pasport_code = Users::getPassportCode(self::SOCIAL_ROLE);
     if ($supervisor->save()) {
         $supervisor_org_relation = new OrganizationsSupervisors();
         $supervisor_org_relation->user_id = $supervisor->id;
         $supervisor_org_relation->organization_id = $org_id;
         return $supervisor_org_relation->save();
     }
     return false;
 }
예제 #2
0
파일: Users.php 프로젝트: aversilov/prexr
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrganizationsSupervisors()
 {
     return $this->hasMany(OrganizationsSupervisors::className(), ['user_id' => 'id']);
 }