devsdmf/datamonkey 问题修复 & 功能扩展

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

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

devsdmf/datamonkey

最新稳定版本:1.2.3

Composer 安装命令:

composer require devsdmf/datamonkey

包简介

A simple database ORM for PHP projects build on top of Doctrine.

README 文档

README

Join the chat at https://gitter.im/devsdmf/datamonkey

Build Status Coverage Status Latest Stable Version Total Downloads Documentation Status License

A simple database ORM for PHP projects build on top of Doctrine.

Installation

$ composer require devsdmf/datamonkey

Usage

Creating an entity:

namespace Vendor\Package;

use DataMonkey\Entity\ExportableEntity;
use DataMonkey\Entity\ExportAbstract;

class MyEntity extends ExportAbstract implements ExportableEntity
{
    /**
     * @pk
     * @db_ref id_entity
     * @strategy auto
     */
    public $id = null;
    
    /**
     * @db_ref foo_column
     */
    public $foo = null;
}

Creating a factory:

namespace Vendor\Package;

use DataMonkey\Entity\Factory\AbstractFactory;
use Vendor\Package\MyEntity;

class MyFactory extends AbstractFactory
{
    
    public function create($options = null)
    {
        return MyEntity::factory($options);
    }
}

Creating an repository

namespace Vendor\Package;

use DataMonkey\Repository\Repository;

class MyRepository extends Repository
{

    protected $_name = 'mytable';
}

Persisting an entity:

use Vendor\Package\MyEntity;
use Vendor\Package\MyFactory;
use Vendor\Package\MyRepository;

// Configure your doctrine DBAL connection
$connection = new \Doctrine\DBAL\Connection(...);

$entity = new MyEntity();
$entity->foo = 'bar';

$repo = new MyRepository($connection, new MyFactory());
$repo->save($entity);

Done!

Documentation

Tests

$ composer install --dev
$ ./vendor/bin/phpunit

License

This library is licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-23