原则ORM - 前缀表 [英] Doctrine ORM - Prefixing Tables
本文介绍了原则ORM - 前缀表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Doctrine 1.2,并希望知道如何使用它来实现mysql表前缀。
I'm using Doctrine 1.2, and would like to know how I can achieve mysql table prefixes with it.
所以我想要我们的系统在同一个数据库中部署两次,第一个表可以前缀为one_,第二个可以以two _为前缀。
So for instance I would like for our system to be deployed twice on the same database, the first the tables can be prefixed with "one_" and the second can be prefixed with "two_".
任何人都知道如何完成这个我想象它是一个配置设置,但我似乎找不到它。
Anyone got any idea how to accomplish this? I would imagine it is a config setting but I just can't seem to find it.
推荐答案
我没有尝试过但是..从文档:
I haven't tried it but.. from the docs:
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 'one_%s');
或者,您可以在YAML架构中手动定义表名:
Alternatively, you can manually define a table name in your YAML schema:
Foo:
tableName: one_foo
columns:
# etc.
希望这有帮助。
这篇关于原则ORM - 前缀表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文