2017 © Pedro Peláez
 

library doctrine-undeletable

Doctrine annotation to make entities undeletable.

image

fluoresce/doctrine-undeletable

Doctrine annotation to make entities undeletable.

  • Tuesday, June 20, 2017
  • by jaikdean
  • Repository
  • 1 Watchers
  • 1 Stars
  • 890 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 47 % Grown

The README.md

Doctrine Undeletable

This library provides an Undeletable annotation for Doctrine entities., (*1)

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

Installation

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

$ composer require fluoresce/doctrine-undeletable

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*4)

Documentation

Configuration

Symfony

Register the Doctrine event subscriber as a service. In services.yml this would look as follows., (*5)

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

Basic Usage

This example shows a Book ORM entity which should never be deleted., (*6)

<?php

use Doctrine\ORM\Mapping as ORM;
use Fluoresce\DoctrineUndeletable\Mapping\Undeletable;

/**
 * @ORM\Entity
 * @Undeletable
 */
class Book
{
    …
}

When you attempt to delete a Book, an exception will be thrown., (*7)

$book = $entityManager->find('Book', 123);
$entityManager->remove($book);

try {
    $entityManager->flush();
} catch (Fluoresce\DoctrineUndeletable\Exception\UndeletableObjectException $e) {
    // $book was not deleted from the database
}

The Versions

20/06 2017

dev-master

9999999-dev https://github.com/fluoresceco/doctrine-undeletable

Doctrine annotation to make entities undeletable.

  Sources   Download

MIT

The Requires

 

by Jaik Dean

doctrine delete behaviour undeletable undeleteable

20/06 2017

1.0.2

1.0.2.0 https://github.com/fluoresceco/doctrine-undeletable

Doctrine annotation to make entities undeletable.

  Sources   Download

MIT

The Requires

 

by Jaik Dean

doctrine delete behaviour undeletable undeleteable

17/03 2017

1.0.1

1.0.1.0 https://github.com/fluoresceco/doctrine-undeletable

Doctrine annotation to make entities undeletable.

  Sources   Download

MIT

The Requires

 

by Jaik Dean

doctrine delete behaviour undeletable undeleteable

17/03 2017

1.0.0

1.0.0.0 https://github.com/fluoresceco/doctrine-undeletable

Doctrine annotation to make entities undeletable.

  Sources   Download

MIT

The Requires

 

by Jaik Dean

doctrine delete behaviour undeletable undeleteable