Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
VladimirAfonin opened this issue Apr 6, 2021 · 3 comments
Open

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

VladimirAfonin opened this issue Apr 6, 2021 · 3 comments

Comments

@VladimirAfonin
Copy link

VladimirAfonin commented Apr 6, 2021

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;

    ...
    }

`

@felixrupp
Copy link
Contributor

felixrupp commented Aug 25, 2022

Hello @RubenHarms,
we have the same problem as stated and the fix from @bradacjan would work for us, except the line 153 in file SoftDeleteListener.php

Can you give some insight on when the fix will be published?

Thanks and kind regards,
Felix

@RubenHarms
Copy link
Contributor

Hi Felix,

Can you create a pull request voor that?

Thank you.
Kind Regards,
Ruben

@felixrupp
Copy link
Contributor

Hi Felix,

Can you create a pull request voor that?

Thank you. Kind Regards, Ruben

Hi Ruben, I opened a pull-request for the fixes of @bradacjan and added the correct softDelete condition.

one thing that still doesn’t work is the hard-delete after a successful soft-delete. Your Listener is still only capable of soft-deleting.

Thank you and best Regards,
Felix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants