php-platform / persist
该软件包最新版本(v0.1.12)的许可证信息不可用。
v0.1.12
2018-04-09 08:30 UTC
Requires
- php: >=5.5
- php-platform/annotations: ~0.1
- php-platform/config: ~0.1
- php-platform/errors: ~0.1
- php-platform/json-cache: ~0.1
- php-platform/session: ~0.1
Requires (Dev)
README
此软件包允许持久化PHP模型(对象)
简介
此php库允许将关系型模式转换为PHP对象
功能
- 避免用户源代码中的SQL查询
- 优化所有操作的查询
- 依赖注入
- 内置搜索,具有排序和分页功能
- 注解将类和属性映射到表和列
- 支持继承
示例
表格的示例类
use PhpPlatform\Persist\Model; /** * @tableName t_normal1 * @prefix TNormal1 */ class TNormal1 extends Model { /** * @columnName F_PRIMARY_ID * @type integer * @primary * @autoIncrement * @get */ private $fPrimaryId = null; /** * @columnName F_VARCHAR * @type varchar * @set * @get */ private $fVarchar = null; /** * @columnName F_FOREIGN * @type integer * @set * @get */ private $fForeign = null; function __construct($fPrimayId = null){ $this->fPrimaryId = $fPrimayId; parent::__construct(); } static function create( $fVarchar, $fForeign){ $this->fVarchar = $fVarchar; $this->fForeign = $fForeign; parent::create(); } static function find($filters){ return parent::find($filters); } function delete(){ parent::delete(); } function setAttribute($name,$value){ $args = array(); $args[$name] = $value; $attrValues = $this->setAttributes($args); } function setAttributes($args){ parent::setAttributes($args); } function getAttribute($name){ $args = array(); $args[] = $name; $attrValues = $this->getAttributes($args); return $attrValues[$name]; } function getAttributes($args){ return parent::getAttributes($args); } }
更多用法请参阅包含的测试