SHOW:
|
|
- or go back to the newest paste.
| 1 | public function createComponent($name) | |
| 2 | - | private function autoCreateInstanceFromDI($class) {
|
| 2 | + | {
|
| 3 | - | $ref = \Nette\Reflection\ClassType::from($class); |
| 3 | + | if (class_exists($class = "Control$name")) {
|
| 4 | - | $construct = $ref->getMethod('__construct');
|
| 4 | + | return $this[lcFirst($name)] = $this->context->createInstance($class); |
| 5 | - | $classesObjs = array(); |
| 5 | + | |
| 6 | - | foreach ($construct->getParameters() as $param) {
|
| 6 | + | |
| 7 | - | $classesObjs[] = $this->context->getByType($param->getClassName()); |
| 7 | + | return parent::createComponent($name); |
| 8 | } |