From 43f5e542cd8028f700094992cd7509a87f1430ac Mon Sep 17 00:00:00 2001 From: Loveorigami Date: Fri, 17 Jun 2016 10:57:32 +0300 Subject: [PATCH] php 5.5 class --- composer.json | 1 + controllers/EventController.php | 2 +- controllers/ItemController.php | 2 +- models/App.php | 2 +- models/Event.php | 10 +++++----- models/Item.php | 2 +- views/event/_form.php | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index b20fac7..f4dd456 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ ], "require": { "yiisoft/yii2": ">=2.0.6", + "php": ">=5.5.0", "components/highlightjs":"*", "loveorigami/yii2-jsoneditor": "*", "tpoxa/shortcodes": "dev-master" diff --git a/controllers/EventController.php b/controllers/EventController.php index fe2bc59..aa34bd2 100644 --- a/controllers/EventController.php +++ b/controllers/EventController.php @@ -18,7 +18,7 @@ public function behaviors() { return [ 'verbs' => [ - 'class' => VerbFilter::className(), + 'class' => VerbFilter::class, 'actions' => [ 'delete' => ['post'], ], diff --git a/controllers/ItemController.php b/controllers/ItemController.php index ef51213..dab7e12 100644 --- a/controllers/ItemController.php +++ b/controllers/ItemController.php @@ -29,7 +29,7 @@ public function behaviors() { return [ 'verbs' => [ - 'class' => VerbFilter::className(), + 'class' => VerbFilter::class, 'actions' => [ 'delete' => ['post'], ], diff --git a/models/App.php b/models/App.php index 0774171..f3471c9 100644 --- a/models/App.php +++ b/models/App.php @@ -50,7 +50,7 @@ public function attributeLabels() */ public function getEvents() { - return $this->hasMany(Event::className(), ['app_id' => 'id']); + return $this->hasMany(Event::class, ['app_id' => 'id']); } } diff --git a/models/Event.php b/models/Event.php index 3c0a4f4..22ba7b4 100644 --- a/models/Event.php +++ b/models/Event.php @@ -41,9 +41,9 @@ public function rules() [['plugin_id', 'app_id'], 'required'], [['plugin_id', 'status', 'pos'], 'integer'], [['trigger_class', 'trigger_event', 'handler_method'], 'string', 'max' => 255], - [['data'], JsonValidator::className()], - //[['plugin_id'], 'exist', 'skipOnError' => true, 'targetClass' => Item::className(), 'targetAttribute' => ['id']], - //[['app_id'], 'exist', 'skipOnError' => true, 'targetClass' => App::className(), 'targetAttribute' => ['id']], + [['data'], JsonValidator::class], + //[['plugin_id'], 'exist', 'skipOnError' => true, 'targetClass' => Item::class, 'targetAttribute' => ['id']], + //[['app_id'], 'exist', 'skipOnError' => true, 'targetClass' => App::class, 'targetAttribute' => ['id']], ]; } @@ -71,7 +71,7 @@ public function attributeLabels() */ public function getApp() { - return $this->hasOne(App::className(), ['id' => 'app_id']); + return $this->hasOne(App::class, ['id' => 'app_id']); } /** @@ -79,7 +79,7 @@ public function getApp() */ public function getPlugin() { - return $this->hasOne(Item::className(), ['id' => 'plugin_id']); + return $this->hasOne(Item::class, ['id' => 'plugin_id']); } /** diff --git a/models/Item.php b/models/Item.php index 06c05ac..aa39e73 100644 --- a/models/Item.php +++ b/models/Item.php @@ -69,7 +69,7 @@ public function attributeLabels() */ public function getEvents() { - return $this->hasMany(Event::className(), ['plugin_id' => 'id']); + return $this->hasMany(Event::class, ['plugin_id' => 'id']); } /** diff --git a/views/event/_form.php b/views/event/_form.php index bc06581..b79cbed 100644 --- a/views/event/_form.php +++ b/views/event/_form.php @@ -15,7 +15,7 @@
- field($model, 'data')->widget(Jsoneditor::className(), + field($model, 'data')->widget(Jsoneditor::class, [ 'editorOptions' => [ 'modes' => ['code', 'form', 'text', 'tree', 'view'], // available modes