PHPackages                             fluoresce/doctrine-undeletable - 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. fluoresce/doctrine-undeletable

ActiveLibrary[Database &amp; ORM](/categories/database)

fluoresce/doctrine-undeletable
==============================

Doctrine annotation to make entities undeletable.

2.0.0(6y ago)131.4k↓35.7%1MITPHPPHP &gt;=7.4

Since Mar 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/fluoresceco/doctrine-undeletable)[ Packagist](https://packagist.org/packages/fluoresce/doctrine-undeletable)[ Docs](https://github.com/fluoresceco/doctrine-undeletable)[ RSS](/packages/fluoresce-doctrine-undeletable/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (8)Used By (0)

Doctrine Undeletable
====================

[](#doctrine-undeletable)

This library provides an `Undeletable` annotation for Doctrine entities.

When added to an entity class, this annotation causes Doctrine to throw an exception when attempting to delete an entity.

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

[](#installation)

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

```
$ composer require fluoresce/doctrine-undeletable
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.

Documentation
-------------

[](#documentation)

### Configuration

[](#configuration)

#### Symfony

[](#symfony)

Register the Doctrine event subscriber as a service. In `services.yml` this would look as follows.

```
services:
    fluoresce.listener.undeletable:
        class: Fluoresce\DoctrineUndeletable\EventListener\UndeletableSubscriber
        arguments: ["@annotation_reader"]
        tags:
            - { name: doctrine.event_subscriber, connection: default }
```

### Basic Usage

[](#basic-usage)

This example shows a `Book` ORM entity which should never be deleted.

```
