You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.3KB

  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. use common\models\Etablissement ;
  5. use common\models\PointVente ;
  6. /**
  7. * This is the model class for table "commande_auto".
  8. *
  9. * @property integer $id
  10. * @property integer $id_user
  11. * @property integer $id_etablissement
  12. * @property string $date_debut
  13. * @property string $date_fin
  14. * @property integer $lundi
  15. * @property integer $mardi
  16. * @property integer $mercredi
  17. * @property integer $jeudi
  18. * @property integer $vendredi
  19. * @property integer $samedi
  20. * @property integer $dimanche
  21. * @property integer $periodicite_semaine
  22. */
  23. class CommandeAuto extends \yii\db\ActiveRecord
  24. {
  25. /**
  26. * @inheritdoc
  27. */
  28. public static function tableName()
  29. {
  30. return 'commande_auto';
  31. }
  32. /**
  33. * @inheritdoc
  34. */
  35. public function rules()
  36. {
  37. return [
  38. [['id_user', 'id_etablissement', 'id_point_vente'], 'required'],
  39. [['id_user', 'id_etablissement', 'id_point_vente', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche', 'periodicite_semaine'], 'integer'],
  40. [['date_debut', 'date_fin'], 'safe'],
  41. ];
  42. }
  43. /**
  44. * @inheritdoc
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => 'ID',
  50. 'id_user' => 'Utilisateur',
  51. 'id_etablissement' => 'Etablissement',
  52. 'id_point_vente' => 'Point de vente',
  53. 'date_debut' => 'Date de début',
  54. 'date_fin' => 'Date de fin',
  55. 'lundi' => 'Lundi',
  56. 'mardi' => 'Mardi',
  57. 'mercredi' => 'Mercredi',
  58. 'jeudi' => 'Jeudi',
  59. 'vendredi' => 'Vendredi',
  60. 'samedi' => 'Samedi',
  61. 'dimanche' => 'Dimanche',
  62. 'periodicite_semaine' => 'Périodicité',
  63. ];
  64. }
  65. public function getUser()
  66. {
  67. return $this->hasOne(User::className(), ['id'=>'id_user']) ;
  68. }
  69. public function getEtablissement()
  70. {
  71. return $this->hasOne(Etablissement::className(), ['id'=>'id_etablissement']) ;
  72. }
  73. public function getPointVente()
  74. {
  75. return $this->hasOne(PointVente::className(), ['id'=>'id_point_vente']) ;
  76. }
  77. public function getCommandeAutoProduit()
  78. {
  79. return $this->hasMany(CommandeAutoProduit::className(), ['id_commande_auto'=>'id'])->with('produit') ;
  80. }
  81. }