我了解到module.config.php文件中有“工厂”键,该键可能正在读取:
`'controllers' => [
'factories' => [
IndexController::class => IndexControllerFactory::class
],
], `
那么如何以及何时创建IndexControllerFactory?同样与以下代码段有关,如何以及何时调用__invoke方法:
class IndexControllerFactory extends MultibyteControllerFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container,
$requestedName, array $options = null)
{
$entityManager = $container->get('doctrine.entitymanager.orm_default');
return new IndexController($entityManager);
}
}