Looking for symfony 1.4 propel method to operate multiple databases
漂亮男人2017-05-16 16:45:23
0
2
524
Seeking symfony 1.4 propel for practical methods to operate multiple databases. Do not copy from the Internet. You must operate successfully by yourself. I hope there are detailed step-by-step instructions. Thank you so much!
I always use doctrine
If you are connecting to multiple databases
1. Specify the connection of the table when defining the schema
Define database connection parameters in 2.databases.yml
I tested it myself and posted it first
2. It is best to add prefixes to tables in multiple databases to avoid having the same table names and causing some models to be overwritten and lost
3. Generate schema and yml files symfony propel:build-schema
4. Generate form symfony propel:build-form --connection=testa symfony propel:build-form --connection=justb
5Generate filter symfony propel:build-filters --connection=testa symfony propel:build-filters --connection=justb
6. $c = new Criteria(); $a = APeer::doSelect($c, Propel::getConnection('testa')); $b = CPeer::doSelect($c, Propel::getConnection('justb'));