AuthItemChild.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace backend\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%auth_item_child}}".
  6. *
  7. * @property string $parent
  8. * @property string $child
  9. *
  10. * @property AuthItem $parent0
  11. * @property AuthItem $child0
  12. */
  13. class AuthItemChild extends \yii\db\ActiveRecord
  14. {
  15. /**
  16. * @inheritdoc
  17. */
  18. public static function tableName()
  19. {
  20. return '{{%auth_item_child}}';
  21. }
  22. /**
  23. * @inheritdoc
  24. */
  25. public function rules()
  26. {
  27. return [
  28. [['parent', 'child'], 'required'],
  29. [['parent', 'child'], 'string', 'max' => 64],
  30. [['parent'], 'exist', 'skipOnError' => true, 'targetClass' => AuthItem::className(), 'targetAttribute' => ['parent' => 'name']],
  31. [['child'], 'exist', 'skipOnError' => true, 'targetClass' => AuthItem::className(), 'targetAttribute' => ['child' => 'name']],
  32. ];
  33. }
  34. /**
  35. * @inheritdoc
  36. */
  37. public function attributeLabels()
  38. {
  39. return [
  40. 'parent' => 'Parent',
  41. 'child' => 'Child',
  42. ];
  43. }
  44. /**
  45. * @return \yii\db\ActiveQuery
  46. */
  47. public function getParent0()
  48. {
  49. return $this->hasOne(AuthItem::className(), ['name' => 'parent']);
  50. }
  51. /**
  52. * @return \yii\db\ActiveQuery
  53. */
  54. public function getChild0()
  55. {
  56. return $this->hasOne(AuthItem::className(), ['name' => 'child']);
  57. }
  58. }