【发布时间】:2011-05-26 12:43:14
【问题描述】:
大家好,我已将 Symfony admin generator 用于模块。
一切正常,但是当我的模型的表单被实例化时,我需要传入我自己的选项。
我可以自己通过覆盖 myModuleActions.class.php(扩展 myModuleAutoActions)中的 executeNew、executeCreate 函数来实现。
但我希望有一个更简洁的解决方案?
也许重写其中一个配置类是可行的方法。我基本上需要将当前的sf_user 对象($this->getUser)添加为表单的“sf_user”选项,以避免在myModuleForm 中使用sfContext。
有什么想法吗?
【问题讨论】:
-
覆盖 myModuleGeneratorConfiguration 中的“sfModelGeneratorConfiguration::getForm”方法可以工作,但仍然需要我使用 sfContext 来获取当前的 sf_user 对象
标签: php forms symfony1 admin-generator