php-platform/persist 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-platform/persist

Composer 安装命令:

composer require php-platform/persist

包简介

README 文档

README

This package allows persistence of PHP models (Objects)

Build Status

Introduction

This php library allows to convert relational schema to php objects

Features

  • Avoids SQL Queries in user source code
  • Optimized Queries for all operations
  • Dependency Injection
  • built in search with sorting and pagination
  • Annotations to map class and properties to table and columns
  • Supports inheritance

Example

Sample Class for a Table

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);
    }

}

For More Usage please see the included tests

统计信息

  • 总下载量: 1.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-01-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固