Sections.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\models\entity;
  3. use Yii;
  4. /**
  5. * This is the model class for table "sections".
  6. *
  7. * @property int $id
  8. * @property string $name
  9. * @property string $locomotive_series
  10. * @property string $section_number
  11. * @property string $section_subnumber
  12. * @property string $dc_repair
  13. * @property string $type_repair
  14. */
  15. class Sections extends \yii\db\ActiveRecord
  16. {
  17. const SCENARIO_ADD_SECTION = 'add_section';
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function tableName()
  22. {
  23. return 'sections';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function rules()
  29. {
  30. return [
  31. //[['name', 'locomotive_series', 'section_number', 'section_subnumber', 'dc_repair', 'type_repair', 'date_start_repair'], 'required'],
  32. //[['section_subnumber'], 'unique'],
  33. [['section_number', 'section_subnumber','locomotive_series'], 'unique', 'targetAttribute' => ['section_number', 'section_subnumber','locomotive_series']],
  34. //['image', 'required', 'except' => self::SCENARIO_UPDATE_POST]
  35. //[['locomotive_series', 'section_number', 'section_subnumber', 'diagnostic_map'], 'string', 'max' => 255],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'locomotive_series' => 'Locomotive Series',
  46. 'section_number' => 'Section Number',
  47. 'section_subnumber' => 'Section Subnumber',
  48. 'diagnostic_map' => 'Диагностическая карта',
  49. //'type_repair' => 'Type Repair',
  50. ];
  51. }
  52. }