Skip to content

Commit 10aba83

Browse files
authored
Update Shims.md
1 parent 3cd86be commit 10aba83

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

docs/Shims.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,39 @@ use Tools\Controller\Controller;
3333

3434
class AppController extends Controller {
3535

36-
public $components = array('Shim.Session');
36+
public $components = ['Shim.Session'];
3737

3838
}
3939
```
4040
It also contains the new `consume()` method.
41+
42+
43+
## Helper
44+
45+
### Session
46+
The session helper of the core is deprecated and will throw a warning as it will soon be removed.
47+
Better use the plugin one right away. It is a 1:1 clone of it.
48+
```php
49+
namespace App\Controller;
50+
51+
use Tools\Controller\Controller;
52+
53+
class AppController extends Controller {
54+
55+
public $helpers = ['Shim.Session'];
56+
57+
}
58+
```
59+
It also contains the new `consume()` method.
60+
61+
### Configure
62+
63+
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.
64+
Just make sure your controller (or AppView) loads the helper:
65+
```php
66+
// Controller way
67+
public $helpers = ['Shim.Configure'];
68+
69+
// AppView way
70+
$this->loadHelper('Shim.Configure');
71+
```

0 commit comments

Comments
 (0)