tseho/doctrine-assigned-identity 问题修复 & 功能扩展

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

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

tseho/doctrine-assigned-identity

最新稳定版本:v0.1.0

Composer 安装命令:

composer require tseho/doctrine-assigned-identity

包简介

README 文档

README

Description

This package allows you manually assign IDs to a Doctrine entity, even when the entity uses the stategies AUTO, SEQUENCE, IDENTITY or UUID.

This package's main use-case is to explicitly set IDs of entities that are created for your unit tests. It is not advised to use this package in production.

Installation

composer require --dev tseho/doctrine-assigned-identity

Usage

Register the EventListener in Doctrine.

With Symfony:

# app/config/config_test.yml

services:
    tseho.doctrine_assigned_identity.listener:
        class: Tseho\DoctrineAssignedIdentity\EventListener\AssignedIdentityListener
        public: false
        tags:
            - { name: doctrine.event_listener, event: prePersist }

How does it work?

AssignedIdentityListener will override the ID generator of an entity class if there is a newly persisted instance with a manually assigned id. For all the other instances of the same class without id, the ChainedGenerator will fallback on the correct id generator.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-04