PHPackages                             core23/doctrine-extensions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. core23/doctrine-extensions

Abandoned → [nucleos/doctrine-extensions](/?search=nucleos%2Fdoctrine-extensions)Library[Database &amp; ORM](/categories/database)

core23/doctrine-extensions
==========================

Useful doctrine event hooks.

3.3.0(6y ago)17.8k1[3 issues](https://github.com/nucleos/doctrine-extensions/issues)MITPHPPHP ^7.2CI passing

Since Dec 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/nucleos/doctrine-extensions)[ Packagist](https://packagist.org/packages/core23/doctrine-extensions)[ Docs](https://core23.de)[ RSS](/packages/core23-doctrine-extensions/feed)WikiDiscussions 5.3.x Synced today

READMEChangelog (10)Dependencies (13)Versions (14)Used By (0)

Doctrine Extensions
===================

[](#doctrine-extensions)

[![Latest Stable Version](https://camo.githubusercontent.com/3c18f72e8847977425310f7a7e364642f81332537d3fd43ce17dbb43b4550302/68747470733a2f2f706f7365722e707567782e6f72672f6e75636c656f732f646f637472696e652d657874656e73696f6e732f762f737461626c65)](https://packagist.org/packages/nucleos/doctrine-extensions)[![Latest Unstable Version](https://camo.githubusercontent.com/0af5faed573e496d390ef2e700c25198233244a2485b38248d8021f2944e6a34/68747470733a2f2f706f7365722e707567782e6f72672f6e75636c656f732f646f637472696e652d657874656e73696f6e732f762f756e737461626c65)](https://packagist.org/packages/nucleos/doctrine-extensions)[![License](https://camo.githubusercontent.com/e7e7463c7eaed7de6237fdafc855a35134b04d3b8625507b53d9e5f153992036/68747470733a2f2f706f7365722e707567782e6f72672f6e75636c656f732f646f637472696e652d657874656e73696f6e732f6c6963656e7365)](LICENSE.md)

[![Total Downloads](https://camo.githubusercontent.com/caed39f1297f5ef492ebed4b3b492b5cbc936f9bd1a8c1abfc17fdf23f0212ee/68747470733a2f2f706f7365722e707567782e6f72672f6e75636c656f732f646f637472696e652d657874656e73696f6e732f646f776e6c6f616473)](https://packagist.org/packages/nucleos/doctrine-extensions)[![Monthly Downloads](https://camo.githubusercontent.com/1ed58d2d0cb2e0788f09ae08dc74053686eb8143358296fd08ee990cfa113536/68747470733a2f2f706f7365722e707567782e6f72672f6e75636c656f732f646f637472696e652d657874656e73696f6e732f642f6d6f6e74686c79)](https://packagist.org/packages/nucleos/doctrine-extensions)[![Daily Downloads](https://camo.githubusercontent.com/143eae7a27db9a271ea8fa5a7307115ae1e28b0166617a024290a90eb12faa9c/68747470733a2f2f706f7365722e707567782e6f72672f6e75636c656f732f646f637472696e652d657874656e73696f6e732f642f6461696c79)](https://packagist.org/packages/nucleos/doctrine-extensions)

[![Continuous Integration](https://github.com/nucleos/nucleos-doctrine-extensions/actions/workflows/continuous-integration.yml/badge.svg?event=push)](https://github.com/nucleos/nucleos-doctrine-extensions/actions?query=workflow%3A%22Continuous+Integration%22+event%3Apush)[![Code Coverage](https://camo.githubusercontent.com/2fa49475b20bde61fd22657ba7da0a0dccdbff65a8300413a4bfa3525255fdec/68747470733a2f2f636f6465636f762e696f2f67682f6e75636c656f732f6e75636c656f732d646f637472696e652d657874656e73696f6e732f67726170682f62616467652e737667)](https://codecov.io/gh/nucleos/nucleos-doctrine-extensions)

This library provides adds some useful doctrine hooks.

Installation
------------

[](#installation)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:

```
composer require nucleos/doctrine-extensions

```

Usage
-----

[](#usage)

### Confirmable entities

[](#confirmable-entities)

If you need entities that needs to be confirmed, just implement the `Nucleos\Doctrine\Model\Confirmable`in your entity class.

If you don't need the symfony framework, you need to register the `Nucleos\Doctrine\EventListener\ORM\ConfirmableListener`.

### Deleteable entities

[](#deleteable-entities)

If you need entities that should be soft deleted, just implement the `Nucleos\Doctrine\Model\Deletable`in your entity class.

If you don't need the symfony framework, you need to register the `Nucleos\Doctrine\EventListener\ORM\DeletableListener`.

### Lifecyle aware enties

[](#lifecyle-aware-enties)

If you need lifecyle information (creation / update date), just implement the `Nucleos\Doctrine\Model\LifecycleAware`in your entity class.

If you don't need the symfony framework, you need to register the `Nucleos\Doctrine\EventListener\ORM\LifecycleDateListener`.

### Position aware entities

[](#position-aware-entities)

If you need sortable entities, just implement the `Nucleos\Doctrine\Model\PositionAware`in your entity class.

If you don't need the symfony framework, you need to register the `Nucleos\Doctrine\EventListener\ORM\SortableListener`.

### Unique active entities

[](#unique-active-entities)

If you need entities that should only have one active state, just implement the `Nucleos\Doctrine\Model\UniqueActiveAware`in your entity class.

If you don't need the symfony framework, you need to register the `Nucleos\Doctrine\EventListener\ORM\UniqueActiveListener`.

### Table prefix

[](#table-prefix)

If you need a prefix for all of you application tables and sequences, you could use the `TablePrefixEventListener`. If the table name does already start with the defined prefix, it will be ignored.

If you don't need the symfony framework, you need to register the `Nucleos\Doctrine\EventListener\ORM\TablePrefixEventListener`.

Migration usage
---------------

[](#migration-usage)

1. Update your `id` column from `integer` to `guid`.
2. Create a new migration:

```
// src/Migrations/Version123.php
