Skip to content

SET NULL for child not working after parent soft deleted #30

@VladimirAfonin

Description

@VladimirAfonin

After parent is soft deleted child cascade deleting rather than set null.

I have parent class:

`
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/*

  • @Orm\Entity(repositoryClass="AppBundle\Entity\PaymentRepository")
  • @gedmo\SoftDeleteable(fieldName="deletedAt")
    */
    class Payment
    {
    ...
    }
    `
    and the child with SET NULL method by Evence:

`
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Evence\Bundle\SoftDeleteableExtensionBundle\Mapping\Annotation as Evence;

/*

  • @Orm\Entity(repositoryClass="AppBundle\Entity\TransactionRepository")
    */
    class Transaction
    {

    ...

    /**

    • @Orm\ManyToOne(targetEntity="App\Entity\Payment", inversedBy="translations")
    • @Orm\JoinColumn(nullable=true)
    • @evence\onSoftDelete(type="SET NULL")
      */
      private $payment = null;

    ...
    }

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions