Accounts-obsolete.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace app\models\entity;
  3. use Yii;
  4. /**
  5. * This is the model class for table "accounts".
  6. *
  7. * @property int $id
  8. * @property string $name
  9. * @property int $cmdlevel
  10. * @property string $phone
  11. * @property string $password
  12. * @property string $login
  13. * @property string $email
  14. * @property string $skype
  15. * @property int $company_id
  16. * @property int $active_company
  17. * @property string $active_device_id
  18. * @property string $active_task_ids
  19. * @property string $created
  20. * @property string $jobtypes
  21. * @property string $last_seen_mobile
  22. * @property string $last_seen_web
  23. *
  24. * @property Companies $company
  25. * @property AccountsJobtypes[] $accountsJobtypes
  26. */
  27. class Accounts extends \yii\db\ActiveRecord
  28. {
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public static function tableName()
  33. {
  34. return 'accounts';
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function rules()
  40. {
  41. return [
  42. [['name', 'cmdlevel', 'password', 'login', 'active_company', 'jobtypes'], 'required'],
  43. [['cmdlevel', 'company_id', 'active_company'], 'integer'],
  44. [['created', 'last_seen_mobile', 'last_seen_web'], 'safe'],
  45. [['name', 'phone', 'password', 'login', 'email', 'active_device_id', 'jobtypes'], 'string', 'max' => 255],
  46. [['skype'], 'string', 'max' => 32],
  47. [['active_task_ids'], 'string', 'max' => 100],
  48. [['login'], 'unique'],
  49. [['name'], 'unique'],
  50. [['company_id'], 'exist', 'skipOnError' => true, 'targetClass' => Companies::className(), 'targetAttribute' => ['company_id' => 'id']],
  51. ];
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function attributeLabels()
  57. {
  58. return [
  59. 'id' => 'ID',
  60. 'name' => 'Name',
  61. 'cmdlevel' => 'Cmdlevel',
  62. 'phone' => 'Phone',
  63. 'password' => 'Password',
  64. 'login' => 'Login',
  65. 'email' => 'Email',
  66. 'skype' => 'Skype',
  67. 'company_id' => 'Company ID',
  68. 'active_company' => 'Active Company',
  69. 'active_device_id' => 'Active Device ID',
  70. 'active_task_ids' => 'Active Task Ids',
  71. 'created' => 'Created',
  72. 'jobtypes' => 'Jobtypes',
  73. 'last_seen_mobile' => 'Last Seen Mobile',
  74. 'last_seen_web' => 'Last Seen Web',
  75. ];
  76. }
  77. /**
  78. * @return \yii\db\ActiveQuery
  79. */
  80. public function getCompany()
  81. {
  82. return $this->hasOne(Companies::className(), ['id' => 'company_id']);
  83. }
  84. /**
  85. * @return \yii\db\ActiveQuery
  86. */
  87. public function getAccountsJobtypes()
  88. {
  89. return $this->hasMany(AccountsJobtypes::className(), ['account_id' => 'id']);
  90. }
  91. }