[TYPO3-dev] [DBAL] two tables with same name in different DBs

Jost Baron jost.baron at gmx.de
Fri Jun 20 00:33:26 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi TYPO3 developers,

I want to query two external databases. Both use have the same schema.
How do I map the tables in DBAL configuration to be able to access
both of the schemas?

Currently, I have this configuration: http://dpaste.com/38MAYK4 (also
appended below). This does not work, since in the
table2handlerKeys-array, the *real* table name has to be used. And
since both my tables are named "tablename", I would have a duplicate key.

So how do I do such a thing? I can't change the table name in one of
the databases.

Regards,
Jost

'dbal' => array(
    'handlerCfg' => array(
        '_DEFAULT' => array(
            'config' => array(...),
            'type' => 'native',
        ),
        'externalDB1' => array(
            'config' => array(...),
            'type' => 'native',
        ),
        'externalDB2' => array(
            'config' => array(...),
            'type' => 'native',
        ),
    ),
    'table2handlerKeys' => array(
        'db1_tablename' => 'externalDB1',
        'db2_tablename' => 'externalDB2',
    ),
    'mapping' => array(
        'db1_tablename' => array(
            'mapTableName' => 'tablename',
            'mapFieldNames' => array(...),
        ),
        'db2_tablename' => array(
            'mapTableName' => 'tablename',
            'mapFieldNames' => array(...),
        ),
    ),
),

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlOjZTYACgkQNme/yCvmvTKaLACeI6/Len855wTdaGJw2zvWGn6I
Yp0AniNgFU7Fggklc6121QjTWPhBj4PO
=3ZkC
-----END PGP SIGNATURE-----



More information about the TYPO3-dev mailing list