Browse Source

Indentation + commentaires modèle CreditForm / MailForm

dev
Guillaume Bourgeois 6 years ago
parent
commit
0ac3984851
2 changed files with 19 additions and 9 deletions
  1. +11
    -5
      backend/models/CreditForm.php
  2. +8
    -4
      backend/models/MailForm.php

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

/** /**
* ContactForm is the model behind the contact form. * ContactForm is the model behind the contact form.
*/ */
class CreditForm extends Model {
class CreditForm extends Model
{


public $id_user ; public $id_user ;
public $id_user_action ; public $id_user_action ;
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function rules() {
public function rules()
{
return [ return [
[['montant'], 'required'], [['montant'], 'required'],
[['id_user', 'id_user_action', 'id_etablissement'], 'integer'], [['id_user', 'id_user_action', 'id_etablissement'], 'integer'],
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function attributeLabels() {
public function attributeLabels()
{
return [ return [
'id_user' => 'Utilisateur', 'id_user' => 'Utilisateur',
'id_user_action' => 'Utilisateur', 'id_user_action' => 'Utilisateur',
]; ];
} }
public function save() {
/**
* Enregistre un modèle CreditHistorique.
*/
public function save()
{
if ($this->validate()) { if ($this->validate()) {
$credit_historique = new CreditHistorique ; $credit_historique = new CreditHistorique ;
$credit_historique->id_user = $this->id_user; $credit_historique->id_user = $this->id_user;
'credit_form' => $this 'credit_form' => $this
]) ; ]) ;
} }
} }
} }



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

/** /**
* ContactForm is the model behind the contact form. * ContactForm is the model behind the contact form.
*/ */
class MailForm extends Model {
class MailForm extends Model
{


public $subject; public $subject;
public $body; public $body;
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function rules() {
public function rules()
{
return [ return [
// name, email, subject and body are required // name, email, subject and body are required
[['subject', 'body'], 'required', 'message' => 'Champs obligatoire'], [['subject', 'body'], 'required', 'message' => 'Champs obligatoire'],
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function attributeLabels() {
public function attributeLabels()
{
return [ return [
'subject' => 'Sujet', 'subject' => 'Sujet',
'body' => 'Message', 'body' => 'Message',
* @param string $email the target email address * @param string $email the target email address
* @return boolean whether the email was sent * @return boolean whether the email was sent
*/ */
public function sendEmail($email) {
public function sendEmail($email)
{


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

Loading…
Cancel
Save