Download .zip |
Info | Documentation | View files (38) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2017-05-29 (5 days ago) | Not yet rated by the users | Total: 44 This week: 44 | All time: 8,864 This week: 12 |
Version | License | PHP version | Categories | |||
simpleorm 1.0 | GNU General Publi... | 5 | PHP 5, Databases, Design Patterns |
Description | Author | ||||||||
This package can manage objects stored in a database using a ORM. |
|
PHP ORM Database in simplest way.
Include autoload file of SimpleORM to your project
require_once '../SimpleORM/autoload.php';
$configs = array(
'host' => 'localhost', // host name
'name' => 'd2_test2', //db name
'user' => 'root', //user db
'pwd' => '123456',//password db
'port' => 3306, // port connector
'prefix' => 'tbl_', // prefix for tables
'adapter' => 'mysqli', // adapter, supported MySQLi and PDO
'charset' => 'utf8', // charset of connector
'type' => 'mysql' // type of connection in case using PDO
);
$db = new Connector($configs);
??? Look the database sql file in folder "test/d2_test2.sql".
$oModel = new Model("client");
$oModel->getTable()->setPrimaryKey("client_id"); // should set primary key for table
$query = $oModel->createQuery();
$mData = $oModel->createQuery()->where('client_id',1,'>')->select('*')->getAll();
$oRelation = new Relation($this);
// 1-1
$oRelation->hasOne('info',array(
'source' => 'client_id', // from table column
'target' => 'client_id', // to target table column
'table' => 'client_info' // target table
));
// 1-n
$oRelation->hasMany('apps',array(
'source' => 'client_id',
'target' => 'client_id',
'table' => 'client_app'
));
// n-1
$oRelation->belongsTo('client_type',array(
'source' => 'level',
'target' => 'id',
'table' => 'client_type',
));
// n- n with bride(junction) table client_group
$oRelation->hasManyToMany('groups',array(
'source' => 'client_id', // from table column
'target' => 'id', // to target table column
'table' => 'group', // target table
'option' => array(
'bridge' => array(
'table' => 'client_group', // junction table
'source' => array(
'client_id' => 'client_id' // mapping junction table & source table
),
'target' => array(
'id' => 'group_id',// mapping junction table & target table
)
)
)
));
Files | / | .settings |
File | Role | Description |
---|---|---|
org.eclipse.php.core.prefs | Data | Auxiliary data |
org.eclipse.wst.co...ject.facet.core.xml | Data | Auxiliary data |
Files | / | SimpleORM |
File | Role | Description | ||
---|---|---|---|---|
Adapter (4 files) | ||||
Db (5 files) | ||||
Helper (6 files) | ||||
autoload.php | Aux. | Auxiliary script |
Files | / | SimpleORM | / | Adapter |
File | Role | Description |
---|---|---|
DbMockup.php | Class | Class source |
IAdapter.php | Class | Class source |
Mysqli.php | Class | Class source |
PDO.php | Class | Class source |
Files | / | SimpleORM | / | Db |
File | Role | Description |
---|---|---|
Model.php | Class | Class source |
Reference.php | Class | Class source |
Relation.php | Class | Class source |
Row.php | Class | Class source |
Table.php | Class | Class source |
Files | / | SimpleORM | / | Helper |
File | Role | Description |
---|---|---|
Connector.php | Class | Class source |
Exception.php | Class | Class source |
Object.php | Class | Class source |
Query.php | Class | Class source |
Tool.php | Class | Class source |
Validator.php | Class | Class source |
Files | / | test |
File | Role | Description | ||
---|---|---|---|---|
DbTest (1 file, 2 directories) | ||||
.buildpath | Data | Auxiliary data | ||
.project | Data | Auxiliary data | ||
d2_test2.sql | Data | Auxiliary data | ||
dbconfig.php | Aux. | Auxiliary script | ||
generate-db-config.php | Example | Example script | ||
generate-model.php | Example | Example script | ||
index.php | Example | Example script | ||
test-validator.php | Example | Example script | ||
using-dynamic-mapper.php | Example | Example script |
Files | / | test | / | DbTest |
File | Role | Description | ||
---|---|---|---|---|
Client (5 files) | ||||
ClientApp (2 files) | ||||
autoload.php | Aux. | Auxiliary script |
Files | / | test | / | DbTest | / | Client |
File | Role | Description |
---|---|---|
Model.php | Class | Class source |
Reference.php | Class | Class source |
Relation.php | Class | Class source |
Row.php | Class | Class source |
Table.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.