Gets the current Db connection, the connection object is obtained from
the TActiveRecordManager if connection is currently null.
public getDbConnection ( ) : TDbConnection | ||
Résultat | TDbConnection | current db connection for this object. |
/** * @param TActiveRecord $record * @return TDataGatewayCommand */ public function getCommand(TActiveRecord $record) { $conn = $record->getDbConnection(); $connStr = $conn->getConnectionString(); $tableInfo = $this->getRecordTableInfo($record); if (!isset($this->_commandBuilders[$connStr])) { $builder = $tableInfo->createCommandBuilder($record->getDbConnection()); $command = new TDataGatewayCommand($builder); $command->OnCreateCommand[] = array($this, 'onCreateCommand'); $command->OnExecuteCommand[] = array($this, 'onExecuteCommand'); $this->_commandBuilders[$connStr] = $command; } $this->_commandBuilders[$connStr]->getBuilder()->setTableInfo($tableInfo); $this->_currentRecord = $record; return $this->_commandBuilders[$connStr]; }