ericsnguyen/micromongo 问题修复 & 功能扩展

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

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

ericsnguyen/micromongo

Composer 安装命令:

composer require ericsnguyen/micromongo

包简介

description

README 文档

README

small object document mapper.

Usage

At your endpoint

    list($mongo, $database) = ApplicationDbContext::initialDbConnection();
    // binding it to DI container to reuse
    SimpleDi::bindingInstance(Database::class,$database);
    SimpleDi::bindingInstance(Client::class, $mongo);

Define Entity

class ARandomEntity extends BaseEntity
{
    /**
     * if you want to igrnore this field,
     * just put @\MicroOdm\Annotations\UnPersist() to it
     * @UnPersist
     * @var array
     */
    private array $domainEvents = [];    
    protected ?int $iid;
    // for multi domain
    protected ?string $dmn;
    protected ?string $school;
    protected ?User $u;
    
    // for the nest object, must define full namespace
    // we will upgrade in next version
    /**
     * @return \Uni\Domains\Share\ObjectValues\User|null
     */
    public function getU(): ?User
    {
        return $this->u;
    }

    /**
     * @param \Uni\Domains\Share\ObjectValues\User|null $u
     */
    public function setU(?User $u): void
    {
        $this->u = $u;
    }

}

Get the Repository to interact with Db

// at repository
class CreditRepository extends BaseEntityRepository
{
    public function __construct(Database $database)
    {
        // the entity class
        $entityClass = Credit::class;
        parent::__construct($entityClass, $database);
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固