diff --git a/WebLoader/Nette/Extension.php b/WebLoader/Nette/Extension.php index c3b0d95..9e3da7e 100644 --- a/WebLoader/Nette/Extension.php +++ b/WebLoader/Nette/Extension.php @@ -161,7 +161,12 @@ private function addWebLoader(ContainerBuilder $builder, $name, $config) public function afterCompile(Nette\PhpGenerator\ClassType $class) { $meta = $class->properties['meta']; - $meta->value['types']['webloader\\loaderfactory'] = $meta->value['types']['webloader\\nette\\loaderfactory']; + if (array_key_exists('webloader\\nette\\loaderfactory', $meta->value['types'])) { + $meta->value['types']['webloader\\loaderfactory'] = $meta->value['types']['webloader\\nette\\loaderfactory']; + } + if (array_key_exists('WebLoader\\Nette\\LoaderFactory', $meta->value['types'])) { + $meta->value['types']['WebLoader\\LoaderFactory'] = $meta->value['types']['WebLoader\\Nette\\LoaderFactory']; + } $init = $class->methods['initialize']; $init->addBody('if (!class_exists(?, ?)) class_alias(?, ?);', array('WebLoader\\LoaderFactory', FALSE, 'WebLoader\\Nette\\LoaderFactory', 'WebLoader\\LoaderFactory'));