Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrganizationsSupervisors()
 {
     return $this->hasMany(OrganizationsSupervisors::className(), ['user_id' => 'id']);
 }