Skip to content

Soft Deleting

Mitchell van Wijngaarden edited this page May 10, 2014 · 1 revision

Soft Deletes is also one of those things I've added to this package to work right out of the box. It's the same thing like with Timestamps. Simply add the trait SoftDeletes, make sure the database table has the deleted_at column and you're good to go!

<?php

use Doctrine\ORM\Mapping AS ORM;
use Mitch\LaravelDoctrine\Traits\SoftDeletes;

/**
 * @ORM\Entity
 * @ORM\Table(name="users")
 */
class User
{
    use SoftDeletes;

    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string")
     */
    private $name;
}