Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

93 lines
1.8KB

  1. <?php
  2. namespace domain\Product\Rotating;
  3. use common\components\ActiveRecordCommon;
  4. use domain\Producer\Producer\Producer;
  5. use yii\db\ActiveQuery;
  6. class Rotating extends ActiveRecordCommon
  7. {
  8. public static function tableName()
  9. {
  10. return 'rotating';
  11. }
  12. public function rules()
  13. {
  14. return [
  15. [['id_producer', 'name', 'day'], 'required'],
  16. [['name'], 'string', 'max' => 255],
  17. [['id_producer', 'day', 'status'], 'integer'],
  18. ];
  19. }
  20. public function attributeLabels()
  21. {
  22. return [
  23. 'id' => 'ID',
  24. 'id_producer' => 'Producteur',
  25. 'name' => 'Nom',
  26. 'day' => 'Jour',
  27. 'status' => 'Statut',
  28. ];
  29. }
  30. /* Getters / Setters */
  31. public function getId(): ?int
  32. {
  33. return $this->id;
  34. }
  35. public function getProducer(): Producer
  36. {
  37. return $this->producerRelation;
  38. }
  39. public function setProducer(Producer $producer): self
  40. {
  41. $this->populateFieldObject('id_producer', 'producerRelation', $producer);
  42. return $this;
  43. }
  44. public function getName(): string
  45. {
  46. return $this->name;
  47. }
  48. public function setName(string $name): self
  49. {
  50. $this->name = $name;
  51. return $this;
  52. }
  53. public function getDay(): int
  54. {
  55. return $this->day;
  56. }
  57. public function setDay(int $day): self
  58. {
  59. $this->day = $day;
  60. return $this;
  61. }
  62. public function getStatus(): int
  63. {
  64. return $this->status;
  65. }
  66. public function setStatus(int $status): self
  67. {
  68. $this->status = $status;
  69. return $this;
  70. }
  71. /* Relations */
  72. public function getProducerRelation(): ActiveQuery
  73. {
  74. return $this->hasOne(Producer::class, ['id' => 'id_producer']);
  75. }
  76. }