1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace app\models\entity;
- use Yii;
- /**
- * This is the model class for table "accounts".
- *
- * @property int $id
- * @property string $name
- * @property int $cmdlevel
- * @property string $phone
- * @property string $password
- * @property string $login
- * @property string $email
- * @property string $skype
- * @property int $company_id
- * @property int $active_company
- * @property string $active_device_id
- * @property string $active_task_ids
- * @property string $created
- * @property string $jobtypes
- * @property string $last_seen_mobile
- * @property string $last_seen_web
- *
- * @property Companies $company
- * @property AccountsJobtypes[] $accountsJobtypes
- */
- class Accounts extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'accounts';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['name', 'cmdlevel', 'password', 'login', 'active_company', 'jobtypes'], 'required'],
- [['cmdlevel', 'company_id', 'active_company'], 'integer'],
- [['created', 'last_seen_mobile', 'last_seen_web'], 'safe'],
- [['name', 'phone', 'password', 'login', 'email', 'active_device_id', 'jobtypes'], 'string', 'max' => 255],
- [['skype'], 'string', 'max' => 32],
- [['active_task_ids'], 'string', 'max' => 100],
- [['login'], 'unique'],
- [['name'], 'unique'],
- [['company_id'], 'exist', 'skipOnError' => true, 'targetClass' => Companies::className(), 'targetAttribute' => ['company_id' => 'id']],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'name' => 'Name',
- 'cmdlevel' => 'Cmdlevel',
- 'phone' => 'Phone',
- 'password' => 'Password',
- 'login' => 'Login',
- 'email' => 'Email',
- 'skype' => 'Skype',
- 'company_id' => 'Company ID',
- 'active_company' => 'Active Company',
- 'active_device_id' => 'Active Device ID',
- 'active_task_ids' => 'Active Task Ids',
- 'created' => 'Created',
- 'jobtypes' => 'Jobtypes',
- 'last_seen_mobile' => 'Last Seen Mobile',
- 'last_seen_web' => 'Last Seen Web',
- ];
- }
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getCompany()
- {
- return $this->hasOne(Companies::className(), ['id' => 'company_id']);
- }
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getAccountsJobtypes()
- {
- return $this->hasMany(AccountsJobtypes::className(), ['account_id' => 'id']);
- }
- }
|