Doctrine ORM - Prefixing Tables
I'm using Doctrine 1.2, and would like to know how I can achieve mysql table prefixes with it.
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? 开发者_如何学GoI 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');
Alternatively, you can manually define a table name in your YAML schema:
Foo:
tableName: one_foo
columns:
# etc.
Hope this helps.
If you have a UML model of the domain, you can use this UML to Doctrine online service to generate different versions of the corresponding Doctrine script, each one with different prefixes for the tables (choosing a prefix is one of the configuration options you can change as part of the generation process)
精彩评论