浏览代码

Update Shims.md

Mark Sch 9 年之前
父节点
当前提交
10aba83315
共有 1 个文件被更改,包括 32 次插入1 次删除
  1. 32 1
      docs/Shims.md

+ 32 - 1
docs/Shims.md

@@ -33,8 +33,39 @@ use Tools\Controller\Controller;
 
 class AppController extends Controller {
 
-	public $components = array('Shim.Session');
+	public $components = ['Shim.Session'];
 
 }
 ```
 It also contains the new `consume()` method.
+
+
+## Helper
+
+### Session
+The session helper of the core is deprecated and will throw a warning as it will soon be removed.
+Better use the plugin one right away. It is a 1:1 clone of it.
+```php
+namespace App\Controller;
+
+use Tools\Controller\Controller;
+
+class AppController extends Controller {
+
+	public $helpers = ['Shim.Session'];
+
+}
+```
+It also contains the new `consume()` method.
+
+### Configure
+
+If you have a lot of `Configure::read()` calls in your layout and templates you can either manually include the use statement everywhere, put a class_alias() hack in your bootstrap or just quickly replace the calls with `$this->Configure->read()` as helper call.
+Just make sure your controller (or AppView) loads the helper:
+```php
+// Controller way
+public $helpers = ['Shim.Configure'];
+
+// AppView way
+$this->loadHelper('Shim.Configure');
+```