1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Nette\Bridges\Framework;
13:
14: use Nette;
15:
16:
17: 18: 19:
20: class NetteAccessor extends Nette\Object
21: {
22: private $container;
23:
24:
25: public function __construct(Nette\DI\Container $container)
26: {
27: $this->container = $container;
28: }
29:
30:
31: public function __call($name, $args)
32: {
33: if (substr($name, 0, 6) === 'create') {
34: $method = $this->container->getMethodName('nette.' . substr($name, 6));
35: trigger_error("Factory accessing via nette->$name() is deprecated, use $method().", E_USER_DEPRECATED);
36: return call_user_func_array(array($this->container, $method), $args);
37: }
38: throw new Nette\NotSupportedException;
39: }
40:
41:
42: public function &__get($name)
43: {
44: trigger_error("Service accessing via nette->$name is deprecated, use 'nette.$name'.", E_USER_DEPRECATED);
45: $service = $this->container->getService("nette.$name");
46: return $service;
47: }
48:
49: }
50: