Exemple #1
0
 public static function add($username, $password, $org_id)
 {
     $cashier = new Users();
     $cashier->social_role = self::SOCIAL_ROLE;
     $cashier->username = $username;
     $cashier->password = $password;
     $cashier->pasport_code = Users::getPassportCode(self::SOCIAL_ROLE);
     if ($cashier->save()) {
         $cashier_org_relation = new OrganizationsCashiers();
         $cashier_org_relation->user_id = $cashier->id;
         $cashier_org_relation->organization_id = $org_id;
         return $cashier_org_relation->save();
     }
     return false;
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrganizationsCashiers()
 {
     return $this->hasMany(OrganizationsCashiers::className(), ['user_id' => 'id']);
 }