Преглед изворни кода

Indentation + commentaires modèle CommandeAutoForm / CommandeAutoProduit

dev
Guillaume Bourgeois пре 5 година
родитељ
комит
d7348c86c0
2 измењених фајлова са 37 додато и 13 уклоњено
  1. +23
    -8
      common/models/CommandeAutoForm.php
  2. +14
    -5
      common/models/CommandeAutoProduit.php

+ 23
- 8
common/models/CommandeAutoForm.php Прегледај датотеку

@@ -46,7 +46,8 @@ use common\models\CommandeAutoProduit;
/**
* Login form
*/
class CommandeAutoForm extends Model {
class CommandeAutoForm extends Model
{

public $id;
public $id_user;
@@ -69,7 +70,8 @@ class CommandeAutoForm extends Model {
/**
* @inheritdoc
*/
public function rules() {
public function rules()
{
return [
[['id_etablissement', 'periodicite_semaine', 'id_point_vente'], 'integer'],
[['date_debut', 'date_fin'], 'date', 'format' => 'php:d/m/Y'],
@@ -84,7 +86,8 @@ class CommandeAutoForm extends Model {
];
}

public function attributeLabels() {
public function attributeLabels()
{
return [
'id' => 'ID',
'id_user' => 'Utilisateur',
@@ -105,10 +108,17 @@ class CommandeAutoForm extends Model {
];
}

public function save() {
/**
* Enregistre la CommandeAuto.
*
* @return boolean
*/
public function save()
{
if ($this->id) {
$commandeauto = CommandeAuto::findOne($this->id);
} else {
}
else {
$commandeauto = new CommandeAuto;
}

@@ -117,9 +127,15 @@ class CommandeAutoForm extends Model {
$commandeauto->username = $this->username;
$commandeauto->id_etablissement = $this->id_etablissement;
$commandeauto->id_point_vente = $this->id_point_vente;
$commandeauto->date_debut = date('Y-m-d', strtotime(str_replace('/', '-', $this->date_debut)));
$commandeauto->date_debut = date(
'Y-m-d',
strtotime(str_replace('/', '-', $this->date_debut)
));
if (strlen($this->date_fin)) {
$commandeauto->date_fin = date('Y-m-d', strtotime(str_replace('/', '-', $this->date_fin)));
$commandeauto->date_fin = date(
'Y-m-d',
strtotime(str_replace('/', '-', $this->date_fin)
));
}
$commandeauto->lundi = $this->lundi;
$commandeauto->mardi = $this->mardi;
@@ -149,7 +165,6 @@ class CommandeAutoForm extends Model {
}
}
}

return true;
}


+ 14
- 5
common/models/CommandeAutoProduit.php Прегледај датотеку

@@ -49,19 +49,22 @@ use common\models\Produit;
* @property integer $id_produit
* @property double $quantite
*/
class CommandeAutoProduit extends \yii\db\ActiveRecord {
class CommandeAutoProduit extends \yii\db\ActiveRecord
{

/**
* @inheritdoc
*/
public static function tableName() {
public static function tableName()
{
return 'commande_auto_produit';
}

/**
* @inheritdoc
*/
public function rules() {
public function rules()
{
return [
[['id_commande_auto', 'id_produit'], 'required'],
[['id_commande_auto', 'id_produit'], 'integer'],
@@ -72,7 +75,8 @@ class CommandeAutoProduit extends \yii\db\ActiveRecord {
/**
* @inheritdoc
*/
public function attributeLabels() {
public function attributeLabels()
{
return [
'id' => 'ID',
'id_commande_auto' => 'Id Commande Auto',
@@ -81,7 +85,12 @@ class CommandeAutoProduit extends \yii\db\ActiveRecord {
];
}

public function getProduit() {
/*
* Relations
*/
public function getProduit()
{
return $this->hasOne(Produit::className(), ['id' => 'id_produit']);
}


Loading…
Откажи
Сачувај