'Champs obligatoire'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id_etablissement' => 'Ajouter une boulangerie', ]; } /** * Sends an email to the specified email address using the information collected by this model. * * @param string $email the target email address * @return boolean whether the email was sent */ public function add() { $user_etablissement_exist = UserEtablissement::find() ->where(['id_user'=>Yii::$app->user->identity->id, 'id_etablissement' =>$this->id_etablissement]) ->one() ; if(!$user_etablissement_exist) { $user_etablissement = new UserEtablissement() ; $user_etablissement->id_user = Yii::$app->user->identity->id ; $user_etablissement->id_etablissement = $this->id_etablissement ; $user_etablissement->save() ; } } }