PHP Class Prado\Data\SqlMap\TSqlMapManager

Use {@link SqlMapGateway getSqlMapGateway()} property to obtain the gateway instance used for querying statements defined in the SqlMap configuration files. $conn = new TDbConnection($dsn,$dbuser,$dbpass); $manager = new TSqlMapManager($conn); $manager->configureXml('mydb-sqlmap.xml'); $sqlmap = $manager->getSqlMapGateway(); $result = $sqlmap->queryForObject('Products');
Since: 3.1
Inheritance: extends Prado\TComponent
Mostrar archivo Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
__construct ( $connection = null ) Constructor, create a new SqlMap manager.
addCacheModel ( TSqlMapCacheModel $cacheModel ) Adds a named cache.
addMappedStatement ( Prado\Data\SqlMap\Statements\IMappedStatement $statement ) Adds a (named) MappedStatement.
addParameterMap ( TParameterMap $parameter )
addResultMap ( TResultMap $result )
configureXml ( $file ) Loads and parses the SqlMap configuration file.
flushCacheModels ( ) Flushes all cached objects that belong to this SqlMap
getCacheDependencies ( ) : TChainedCacheDependency
getCacheModel ( $name ) : TSqlMapCacheModel Gets a cache by name
getDbConnection ( ) : TDbConnection
getMappedStatement ( $name ) : Prado\Data\SqlMap\Statements\IMappedStatement Gets a MappedStatement by name.
getMappedStatements ( ) : TMap
getParameterMap ( $name ) : TParameterMap
getParameterMaps ( ) : TMap
getResultMap ( $name ) : TResultMap Gets a named result map
getResultMaps ( ) : TMap
getSqlmapGateway ( ) : TSqlMapGateway
getTypeHandlers ( ) : TTypeHandlerFactory
setDbConnection ( $conn )

Protected Methods

Method Description
createSqlMapGateway ( ) : TSqlMapGateway Configures the current TSqlMapManager using the given xml configuration file defined in {@link ConfigFile setConfigFile()}.

Method Details

__construct() public method

Constructor, create a new SqlMap manager.
public __construct ( $connection = null )

addCacheModel() public method

Adds a named cache.
public addCacheModel ( TSqlMapCacheModel $cacheModel )
$cacheModel Prado\Data\SqlMap\Configuration\TSqlMapCacheModel

addMappedStatement() public method

Adds a (named) MappedStatement.
public addMappedStatement ( Prado\Data\SqlMap\Statements\IMappedStatement $statement )
$statement Prado\Data\SqlMap\Statements\IMappedStatement

addParameterMap() public method

public addParameterMap ( TParameterMap $parameter )
$parameter Prado\Data\SqlMap\Configuration\TParameterMap

addResultMap() public method

public addResultMap ( TResultMap $result )
$result Prado\Data\SqlMap\Configuration\TResultMap

configureXml() public method

Loads and parses the SqlMap configuration file.
public configureXml ( $file )

createSqlMapGateway() protected method

Configures the current TSqlMapManager using the given xml configuration file defined in {@link ConfigFile setConfigFile()}.
protected createSqlMapGateway ( ) : TSqlMapGateway
return TSqlMapGateway create and configure a new TSqlMapGateway.

flushCacheModels() public method

Flushes all cached objects that belong to this SqlMap
public flushCacheModels ( )

getCacheDependencies() public method

Since: 3.1.5
public getCacheDependencies ( ) : TChainedCacheDependency
return Prado\Caching\TChainedCacheDependency

getCacheModel() public method

Gets a cache by name
public getCacheModel ( $name ) : TSqlMapCacheModel
return Prado\Data\SqlMap\Configuration\TSqlMapCacheModel the cache object.

getDbConnection() public method

public getDbConnection ( ) : TDbConnection
return TDbConnection default database connection

getMappedStatement() public method

Gets a MappedStatement by name.
public getMappedStatement ( $name ) : Prado\Data\SqlMap\Statements\IMappedStatement
return Prado\Data\SqlMap\Statements\IMappedStatement The MappedStatement

getMappedStatements() public method

public getMappedStatements ( ) : TMap
return Prado\Collections\TMap mapped statements collection.

getParameterMap() public method

public getParameterMap ( $name ) : TParameterMap
return Prado\Data\SqlMap\Configuration\TParameterMap the parameter with given ID.

getParameterMaps() public method

public getParameterMaps ( ) : TMap
return Prado\Collections\TMap parameter maps collection.

getResultMap() public method

Gets a named result map
public getResultMap ( $name ) : TResultMap
return Prado\Data\SqlMap\Configuration\TResultMap the result map.

getResultMaps() public method

public getResultMaps ( ) : TMap
return Prado\Collections\TMap result maps collection.

getSqlmapGateway() public method

public getSqlmapGateway ( ) : TSqlMapGateway
return TSqlMapGateway SqlMap gateway.

getTypeHandlers() public method

public getTypeHandlers ( ) : TTypeHandlerFactory
return TTypeHandlerFactory The TypeHandlerFactory

setDbConnection() public method

public setDbConnection ( $conn )