symfony1.0:从操作或组件启动管理生成器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了symfony1.0:从操作或组件启动管理生成器相关的知识,希望对你有一定的参考价值。

This snippet is useful if you want to include partials of another admin generated module into the current one (at runtime). This is necessary to *always* make sure that the partial is available, even after clearing the cache. And this is not always true. E.g. you're clearing automatically or manually the cache and the partial isn't overridden/existent in the other module's templates directory.
  1. // make sure, that the other module was already generated
  2. try
  3. {
  4. // try to initialize a partial view of the offer module
  5. $view = new sfPartialView();
  6. // this will throw an exception if the partial doesn't exist
  7. $view->initialize($this->getContext(), 'my_module', '_list_td_actions', '');
  8. // call the render() method in order to provoke an exception, so we can generate the module parts
  9. $retval = $view->render(array('my_module' => new SampleModelObject()));
  10. // unset the view object to save memory
  11. unset($view);
  12. }
  13. // catch the exception, fire the admin generator for the offer module, it's neccessary here!
  14. catch (Exception $e)
  15. {
  16. // dividing sf_app_dir and sf_app_module_dir_name is neccessary,
  17. // because sfGeneratorConfigHandler will make a regexp match like /[moduleName]/
  18. // to determine the correct module and pass it to sfCrudGenerator
  19. // therefore, we cant use the sf_app_module_dir setting, because in windows the regexp will not match
  20. $path = array(
  21. sfConfig::get('sf_app_dir'),
  22. sfConfig::get('sf_app_module_dir_name'),
  23. 'my_module',
  24. sfConfig::get('sf_app_module_config_dir_name'),
  25. 'generator.yml'
  26. );
  27. include(sfConfigCache::getInstance()->checkConfig(implode('/', $path)));
  28. }

以上是关于symfony1.0:从操作或组件启动管理生成器的主要内容,如果未能解决你的问题,请参考以下文章

Android 逆向启动 DEX 字节码中的 Activity 组件 ( DEX 文件准备 | 拷贝资源目录下的文件到内置存储区 | 配置清单文件 | 启动 DEX 文件中的组件 | 执行结果 )(代

Symfony 1.0.22 对象保存失败 - 为啥?如何调试这个?

IDEA插件开发(10)---Components

如何从管理员 powershell 启动非管理员进程

r安装组件默认安装器点不了

vue组件中的几种传值方式----下篇