我每天都在使用symfony,實際上你可以有2個數據庫來存儲模型的無關部分。你需要設置在你兩個連接的database.yml(我不熟悉posgress所以你必須弄清楚如何設置它correclty):
mysql_connection:
class: sfPropelDatabase
param:
phptype: mysql
classname: MysqlPropelPDO
dsn: ''
username: user
password: pass
encoding: UTF-8
pooling: true
postgress_connection:
class: sfPropelDatabase
param:
phptype: postgres
classname: PostgresPropelPDO
dsn: ''
username: user
password: pass
encoding: UTF-8
pooling: true
一旦你做到這一點,我們應該得到開始用的schema.yml文件或文件(如要使用2個數據庫,我建議有2個文件,一個爲MySQL,另一個Postgres數據庫裏):
mysql_schema.yml文件:
//This is how you tell witch connection you are using for this tables
connection: mysql_connection
classes:
CLassName:
tableName: table_name
columns:
id:
name:
type: varchar(255)
required: true
[...]
postgres_schema.yml file:
connection: postgress_connection
classes:
ClassName:
tableName: table_name
columns:
id:
name:
type: varchar(255)
required: true
[...]
一旦你完成了架構文件的設置,你應該很好地去創建所有的類並開始玩得開心。希望這可以幫助