In the documentation of Propel2 ORM (http://propelorm.org/documentation/05-transactions.html) there is an example how to wrap queries inside a transaction. The connection is made to a single database table "Account":
$con = Propel::getWriteConnection(AccountTableMap::DATABASE_NAME);
How can I get a global PDO connection object or a connection to 2 tables (e.g. "Account" and "Book")?
For example that's (in pseudocode) what I wish to have:
$con = Propel::getWriteConnection(AccountTableMap::DATABASE_NAME,
BookTableMap::DATABASE_NAME);
The example you quote makes it fairly plain. Your mistake is thinking as you say in your question The connection is made to a single database table "Account":. No a connection is always to a whole database. Propel just provides a way of getting the connection handle that uses a table as a parameter, confusing I grant you.
You do
$con = Propel::getWriteConnection(AccountTableMap::DATABASE_NAME);
on any table, just to get the $con
connection handle.
Transactions are controlled by the connection, not a statement. So once you have the connection object you can start a transaction, and the whole point of a transaction is you can change any number of tables within that transaction as a single unit of work (transaction).
So once you have the $con
handle you start a transaction
$con->beginTransaction();
and any amendments you make between that statement and a
$con->commit();
OR
$con->rollback();
Will all be commited together or all be rolledback together.