/** * Create and configure the data mapper using sqlmap configuration file. * Or if cache is enabled and manager already cached load from cache. * If cache is enabled, the data mapper instance is cached. * * @return TSqlMapManager SqlMap manager instance * @since 3.1.7 */ public function getSqlMapManager() { if (($manager = $this->loadCachedSqlMapManager()) === null) { $manager = new TSqlMapManager($this->getDbConnection()); if (strlen($file = $this->getConfigFile()) > 0) { $manager->configureXml($file); $this->cacheSqlMapManager($manager); } } elseif ($this->getConnectionID() !== '') { $manager->setDbConnection($this->getDbConnection()); } return $manager; }
protected function getMysqlSqlMapManager() { static $conn; static $sqlMapManager; if (Prado::getApplication() === null) { Prado::setApplication(new TApplication(dirname(__FILE__) . '/app')); } if ($conn === null) { $conn = new TDbConnection('mysql:host=localhost;dbname=prado_unitest', 'prado_unitest', 'prado_unitest'); } $conn->setActive(true); if ($sqlMapManager === null) { $sqlMapManager = new TSqlMapManager($conn); $sqlMapManager->configureXml(dirname(__FILE__) . '/DynamicParameterTestMap.xml'); } return $sqlMapManager; }