Guest User

Untitled

a guest
Nov 20th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <?php
  2.  
  3. namespace makspass\entities;
  4.  
  5. use Yii;
  6.  
  7. /**
  8. * This is the model class for table "{{%city}}".
  9. *
  10. * @property integer $id
  11. * @property string $name
  12. * @property string $alias
  13. * @property string $geo_lat
  14. * @property string $geo_lon
  15. * @property integer $zoom
  16. *
  17. * @property Studio[] $studios
  18. */
  19. class City extends \yii\db\ActiveRecord
  20. {
  21.  
  22. /* TODO:: Сделать актуальный город*/
  23.  
  24.  
  25. /**
  26. * @inheritdoc
  27. * @return void
  28. */
  29. public static function tableName()
  30. {
  31. return '{{%city}}';
  32. }
  33.  
  34. /**
  35. * @inheritdoc
  36. */
  37. public function rules()
  38. {
  39. return [
  40. [['name', 'alias', 'geo_lat', 'geo_lon'], 'required'],
  41. [['geo_lat', 'geo_lon'], 'number'],
  42. [['zoom', 'club_count'], 'integer'],
  43. [['name', 'alias'], 'string', 'max' => 255],
  44. ];
  45. }
  46.  
  47. /**
  48. * @inheritdoc
  49. */
  50. public function attributeLabels()
  51. {
  52. return [
  53. 'id' => 'ID',
  54. 'name' => 'Name',
  55. 'alias' => 'Alias',
  56. 'geo_lat' => 'geo_lat',
  57. 'geo_lon' => 'geo_lon',
  58. 'zoom' => 'zoom',
  59. ];
  60. }
  61.  
  62. /**
  63. * @return \yii\db\ActiveQuery
  64. */
  65. public function getStudios()
  66. {
  67. return $this->hasMany(Studio::className(), ['city_id' => 'id']);
  68. }
  69.  
  70. /**
  71. * @inheritdoc
  72. * @return \makspass\entities\query\CityQuery the active query used by this AR class.
  73. */
  74. public static function find()
  75. {
  76. return new \makspass\entities\query\CityQuery(get_called_class());
  77. }
  78. }
Add Comment
Please, Sign In to add comment