脚本宝典收集整理的这篇文章主要介绍了php – 如何使用Propel ORM进行Zend框架,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
但是,这篇文章没有详细介绍如何完成.我猜想我必须修改Zend Bootstrap.PHP和application.ini(我使用的是最新的Zend 1.10.8),但是我发现很难在最新的Zend版本上找到最新版本的Zend Propel版本.
在你的引导
public function inITPropel() { require_once 'Propel.PHP'; Propel::init($this->getOptions('propelConfig')); // so we can get the connection From the registry easily return Propel::getConnection(); }
在你的application.XMl(适应ini,如果你喜欢)
<applicationConfiguration xMLns:zf="http://framework.zend.COM/xml/zend-config-xml/1.0/"> <production> <!-- other stuff --> <includePaths> <propelRuntime><zf:const zf:name="APPLICATION_PATH" />/../library/propel/runtime</propelRuntime> </includePaths> <propelConfig><zf:const zf:name="APPLICATION_PATH" />/configs/propel-runtime.PHP</propelConfig> <!-- other stuff --> </production> </applicationConfiguration>
当然这并不是真正的完全整合,只要我关心…但它应该足以让你运行没有很多麻烦.如果它值得投资给你这个项目,我会继续做一个应用资源.运行propel构建并查看编译的PHP数组.然后将其映射到xml或ini,并将其直接嵌入到应用程序配置文件中.然后修改你的initPropel来处理它:
public function initPropel() { require_once 'Propel.PHP'; Propel::setConfiguration($this->getOptions('propelConfig')); Propel::initialize(); // so we can get the connection from the registry easily return Propel::getConnection(); }
如果您希望您甚至可以不直接从配置文件中加载数组,而是创建一个PropelConfiguration对象并以编程方式设置所有参数,然后将其传递给setConfiguration.
对于构建工具,ive发现与Zend_Tool集成是一种折磨,所以我倾向于依赖于所有这些的phing或custom shell脚本.除非您计划在很多项目上使用Propel,否则可能并没有实现这一级别的集成.我做了一个Doctrine 1.x一段时间,它花了我几个星期工作所有的扭结:-)
以上是脚本宝典为你收集整理的php – 如何使用Propel ORM进行Zend框架全部内容,希望文章能够帮你解决php – 如何使用Propel ORM进行Zend框架所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。