Browse Source

Indentation + commentaires modèle Facture

dev
Guillaume Bourgeois 6 years ago
parent
commit
16bec63152
1 changed files with 21 additions and 6 deletions
  1. +21
    -6
      common/models/Facture.php

+ 21
- 6
common/models/Facture.php View File

* @property string $date_paiement * @property string $date_paiement
* @property string $methode_paiement * @property string $methode_paiement
*/ */
class Facture extends \yii\db\ActiveRecord {
class Facture extends \yii\db\ActiveRecord
{


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


/** /**
* @inheritdoc * @inheritdoc
*/ */
public function rules() {
public function rules()
{
return [ return [
[['id_etablissement', 'paye'], 'integer'], [['id_etablissement', 'paye'], 'integer'],
[['date', 'date_paiement'], 'safe'], [['date', 'date_paiement'], 'safe'],
]; ];
} }


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


/** /**
* @inheritdoc * @inheritdoc
*/ */
public function attributeLabels() {
public function attributeLabels()
{
return [ return [
'id' => 'ID', 'id' => 'ID',
'id_etablissement' => 'Id Etablissement', 'id_etablissement' => 'Id Etablissement',
]; ];
} }


public static function getLastFacture() {
/**
* Retourne la dernière facture émise.
*
* @return Facture
*/
public static function getLastFacture()
{
return Facture::find() return Facture::find()
->orderBy('reference DESC') ->orderBy('reference DESC')
->one(); ->one();

Loading…
Cancel
Save