2017 © Pedro Peláez
 

library doctrine-assigned-identity

image

tseho/doctrine-assigned-identity

  • Wednesday, July 4, 2018
  • by tseho
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

doctrine-assigned-identity

Description

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

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., (*2)

Installation

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

Usage

Register the EventListener in Doctrine., (*3)

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., (*4)

The Versions

04/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Avatar tseho

04/07 2018

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

by Avatar tseho