mtoolkit / mtoolkit-model
The model module of MToolkit framework
0.0.3
2017-11-07 15:41 UTC
Requires
- php: >=5.3.0
- mtoolkit/mtoolkit-core: 0.0.3
Requires (Dev)
- phpunit/phpunit: 5.1.*
This package is not auto-updated.
Last update: 2024-11-08 15:34:51 UTC
README
The model module of MToolkit framework.
Summary
#Intro The module provides the classes to represent x-dimensional models, as list or table. There are a submodule about the sql models: to run a query, to retrieve a resultset, etc...
MDbConnection
It provides a simple singleton way to store the connection to the database. Usages:
// Add a new connection string MDbConnection::addDbConnection( new \PDO( 'mysql:host=127.0.0.1;dbname=test_db', 'root', 'password' ) ); // Retrieve the database connection $connection = MDbConnection::getDbConnection();
MPDOQuery and MPDOResult
Usages:
$query = "SELECT item_01 FROM table_01"; $connection = MDbConnection::getDbConnection(); $sql = new MPDOQuery( $query, $connection ); $sql->bindValue( $key ); $sql->exec(); $result = $sql->getResult();