Sfoglia il codice sorgente

Indentation + commentaires modèle CreditForm / MailForm

refactoring
parent
commit
0ac3984851
2 ha cambiato i file con 19 aggiunte e 9 eliminazioni
  1. +11
    -5
      backend/models/CreditForm.php
  2. +8
    -4
      backend/models/MailForm.php

+ 11
- 5
backend/models/CreditForm.php Vedi File

@@ -49,7 +49,8 @@ use common\helpers\Mail ;
/**
* ContactForm is the model behind the contact form.
*/
class CreditForm extends Model {
class CreditForm extends Model
{

public $id_user ;
public $id_user_action ;
@@ -63,7 +64,8 @@ class CreditForm extends Model {
/**
* @inheritdoc
*/
public function rules() {
public function rules()
{
return [
[['montant'], 'required'],
[['id_user', 'id_user_action', 'id_etablissement'], 'integer'],
@@ -76,7 +78,8 @@ class CreditForm extends Model {
/**
* @inheritdoc
*/
public function attributeLabels() {
public function attributeLabels()
{
return [
'id_user' => 'Utilisateur',
'id_user_action' => 'Utilisateur',
@@ -90,7 +93,11 @@ class CreditForm extends Model {
];
}
public function save() {
/**
* Enregistre un modèle CreditHistorique.
*/
public function save()
{
if ($this->validate()) {
$credit_historique = new CreditHistorique ;
$credit_historique->id_user = $this->id_user;
@@ -115,7 +122,6 @@ class CreditForm extends Model {
'credit_form' => $this
]) ;
}
}
}


+ 8
- 4
backend/models/MailForm.php Vedi File

@@ -44,7 +44,8 @@ use yii\base\Model;
/**
* ContactForm is the model behind the contact form.
*/
class MailForm extends Model {
class MailForm extends Model
{

public $subject;
public $body;
@@ -52,7 +53,8 @@ class MailForm extends Model {
/**
* @inheritdoc
*/
public function rules() {
public function rules()
{
return [
// name, email, subject and body are required
[['subject', 'body'], 'required', 'message' => 'Champs obligatoire'],
@@ -62,7 +64,8 @@ class MailForm extends Model {
/**
* @inheritdoc
*/
public function attributeLabels() {
public function attributeLabels()
{
return [
'subject' => 'Sujet',
'body' => 'Message',
@@ -75,7 +78,8 @@ class MailForm extends Model {
* @param string $email the target email address
* @return boolean whether the email was sent
*/
public function sendEmail($email) {
public function sendEmail($email)
{

return Yii::$app->mailer->compose()
->setTo($email)

Loading…
Annulla
Salva