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.

CommandeProduit.php 1.1KB

8 yıl önce
8 yıl önce
8 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "commande_produit".
  6. *
  7. * @property integer $id
  8. * @property integer $id_commande
  9. * @property integer $id_produit
  10. * @property double $quantite
  11. */
  12. class CommandeProduit extends \yii\db\ActiveRecord
  13. {
  14. /**
  15. * @inheritdoc
  16. */
  17. public static function tableName()
  18. {
  19. return 'commande_produit';
  20. }
  21. /*
  22. * Relations
  23. */
  24. public function getProduit() {
  25. return $this->hasOne(Produit::className(), ['id'=>'id_produit']) ;
  26. }
  27. /**
  28. * @inheritdoc
  29. */
  30. public function rules()
  31. {
  32. return [
  33. [['id_commande', 'id_produit', 'quantite'], 'required'],
  34. [['id_commande', 'id_produit'], 'integer'],
  35. [['quantite'], 'number','min' => 0]
  36. ];
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'id_commande' => 'Id Commande',
  46. 'id_produit' => 'Id Produit',
  47. 'quantite' => 'Quantite',
  48. ];
  49. }
  50. }