brunnofoggia/doctrine-dashes
Composer 安装命令:
composer require brunnofoggia/doctrine-dashes
包简介
This is an additional active record pack for DBAL Integration. It will provide all is needed to connect with a database, read and persist relational data quick and easy.
README 文档
README
This is an additional active record pack for DBAL Integration. It will provide all is needed to connect with a database, read and persist relational data quick and easy
Version notice
This works for DBAL ^2.5
What this plugin provides?
Features for Model
- Persist methods - save, update, create, delete, deleteAll
- Retrieve methods - get, find, exists
- Persist related data methods - saveBelongsTo, saveHasMany, saveHasAndBelongsToMany
- Retrieve related data methods - getRelated, getBelongsTo, getHasMany, getHasAndBelongsToMany
- Properties available for customization: table, primaryKey, foreignKeys[], fieldsFormat[], recursive
Installation
You should install this with composer. Read the VCS repo docs. A initial composer.json would looks like:
{
"require": {
"doctrine/dbal": "^2.5",
"brunnofoggia/doctrine-dashes": "@dev"
}
}
Usage
Import it into classes that will use it
class Sample_model {
use \doctrine\Dashes\Model; protected $table = 'sample';}
Get an instance of the model
2.1. Setting connection config before
\Sample_model::setConnConfig('default', [ 'host' => 'localhost', 'user' => 'root', 'pass' => '123', 'dbname' => 'test' ]); $test = new Sample_model;2.2. Sending connection config
$test = new Sample_model([ 'host' => 'localhost', 'user' => 'root', 'pass' => '123', 'dbname' => 'test' ]);try to read a record
$pk = 1; $test->get($pk);
Detailed documentation
统计信息
- 总下载量: 164
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-23