symfony framework forum • View topic - symfony 2 - DateTime insert/update issue
The connection instance is the main object which provides API for working with your database. The possible keys depend on the current driver, although some configuration keys are the same for all drivers:.
By default, the connection is lazy; it connects to database when needed. You can force the connection by calling connect method; you can also disconnect or reconnect your connection. Use query method to run SQL queries. Take a look on Parameter Modifiers chapter. To retrieve the last inserted id use getLastInsertedId method. For PostgreSQL, the method accepts a sequence name. The number of affected rows is available through getAffectedRows method. Result object implements SeekableIterator.
You can use fetch method to fetch a row, fetchField to fetch the first field form the first row, or fetchAll to return array of rows' objects. The connection object provides convenient API for working with transactions. You can easily beginTransaction , commitTransaction and rollbackTransaction. Usually, you need to react to an exception by calling rollback method. For such use case there is a transactional method that make its callback atomic.
If you call beginTransaction repeatedly without commiting or rollbacking , connection will use savepoints for nested transaction simulation. It is possible to disable such behavior by nestedTransactionsWithSavepoint configuration option.
Connection also supports setting a transaction isolation level. The default isolation level depends on your database. Connection The connection instance is the main object which provides API for working with your database. The possible keys depend on the current driver, although some configuration keys are the same for all drivers: Querying Use query method to run SQL queries.
You may create, release and rollback savepoints directly through appropriate methods.