| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "{{%persons}}".
- *
- * @property int $id
- * @property int|null $org_id
- * @property string|null $first_name
- * @property string|null $last_name
- * @property string|null $position
- * @property int|null $created_at
- * @property int|null $updated_at
- * @property int|null $deleted_at
- *
- * @property Organizations $org
- */
- class Persons extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%persons}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['org_id', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
- [['first_name', 'last_name', 'position'], 'string', 'max' => 191],
- [['org_id'], 'exist', 'skipOnError' => true, 'targetClass' => Organizations::className(), 'targetAttribute' => ['org_id' => 'id']],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'org_id' => 'Org ID',
- 'first_name' => 'First Name',
- 'last_name' => 'Last Name',
- 'position' => 'Position',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'deleted_at' => 'Deleted At',
- ];
- }
- /**
- * Gets query for [[Org]].
- *
- * @return \yii\db\ActiveQuery|OrganizationsQuery
- */
- public function getOrg()
- {
- return $this->hasOne(Organizations::class, ['id' => 'org_id'])->inverseOf('persons');
- }
- /**
- * {@inheritdoc}
- * @return PersonsQuery the active query used by this AR class.
- */
- public static function find()
- {
- return new PersonsQuery(get_called_class());
- }
- }
|