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.

преди 4 години
преди 4 години
преди 4 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "quotation".
  6. *
  7. * @property integer $id
  8. * @property string $name
  9. * @property string $reference
  10. * @property string $date
  11. * @property string $comment
  12. * @property integer $id_user
  13. * @property string $address
  14. * @property string $city
  15. * @property string $postcode
  16. */
  17. class Quotation extends ActiveRecordCommon
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. public static function tableName()
  23. {
  24. return 'quotation';
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['date'], 'safe'],
  33. [['comment', 'address'], 'string'],
  34. [['id_user'], 'integer'],
  35. [['name', 'reference', 'city', 'postcode'], 'string', 'max' => 255],
  36. ];
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'name' => 'Nom',
  46. 'reference' => 'Référence',
  47. 'date' => 'Date',
  48. 'comment' => 'Commentaire',
  49. 'id_user' => 'Utilisateur',
  50. 'address' => 'Adresse',
  51. 'city' => 'Ville',
  52. 'postcode' => 'Code postale',
  53. ];
  54. }
  55. /*
  56. * Relations
  57. */
  58. public function getUser()
  59. {
  60. return $this->hasOne(User::className(), ['id' => 'id_user']);
  61. }
  62. public function getOrder()
  63. {
  64. return $this->hasOne(Order::className(), ['id' => 'id_quotation']);
  65. }
  66. /**
  67. * Retourne les options de base nécessaires à la fonction de recherche.
  68. *
  69. * @return array
  70. */
  71. public static function defaultOptionsSearch() {
  72. return [
  73. 'with' => [],
  74. 'join_with' => ['user', 'order'],
  75. 'orderby' => 'date ASC',
  76. 'attribute_id_producer' => ''
  77. ] ;
  78. }
  79. }