PHP code example of fluoresce / doctrine-undeletable

1. Go to this page and download the library: Download fluoresce/doctrine-undeletable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fluoresce / doctrine-undeletable example snippets




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

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

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

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