qudexin1986 / yorm Goto Github PK
View Code? Open in Web Editor NEWThis project forked from lifei/yorm
Advanced Yii ORM Plugin
This project forked from lifei/yorm
Advanced Yii ORM Plugin
YORM Advanced Yii ORM Plugin YORM是一款Yii的第三方ORM插件,为Yii提供一系列企业应用架构模式中的高级特性,如:读写分离,分表,分库,领域实体,缓存,全局唯一ID以及工作单元。 YORM主要通过继承了Yii的CActiveRecord类开发的CEntity类(实体类),以及一些实现高级特性的行为类,来使Yii程序支持复杂的系统架构设计。 Entity 实体类 class User extends CEntity { // 实现读写分离(分库) public function getDbConnection() { if($this->isDbReading()) { return Yii::app()->readDb; } else { return Yii::app()->writeDb; } } // 实现分表, 根据Id进行散列 private $tableName = "tbl_user_1"; public function updateMeta($id) { $this->tableName = "tbl_user_".($id%10); $this->refreshMetaData(); return $this; } public function tableName() { return $this->tableName; } public function findByPk($pk) { $this->updateMeta($pk); return parent::findByPk($pk); } // 增加工作单元特性 public function behaviors() { return array('UnitOfWorkBehavior' => array('class' => 'UnitOfWorkBehavior')); } } 使用: // 分表 $user = User::model()->updateMeta(10)->findByPk(10);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.