StofDoctrineExtensionsBundle icon indicating copy to clipboard operation
StofDoctrineExtensionsBundle copied to clipboard

[SoftDeletable] How to disable on entity getter

Open Helo3615 opened this issue 3 years ago • 1 comments

Hello,

I have a entity List which has been created by a User List->getCreatedBy(). This User has been softdelete.

I'm requesting the same List and in the data I have createdBy with only the id of the User but if I try to request more information Symfony tell me that there is no User for this id.

Since he was softdelete it's a normal behavior, I suppose. But the thing is, I need these informations, so how can I disable softdeletable only for the getCreatedBy ?

Something like :

Model\List:
  type: entity

  gedmo:
    soft_deleteable:
      field_name: deletedAt
      time_aware: false
      
  manyToOne:
    createdBy:
      targetEntity: Model\User
      gedmo:
        soft_deleteable: false

Thanks you

Helo3615 avatar Apr 08 '22 06:04 Helo3615

Try to disable the softdeleteable filter before getting the info from the database:

$this->entityManager->getFilters()->disable('softdeleteable');

LauLaman avatar Jun 12 '22 23:06 LauLaman

Help for the behavior of extensions should be asked on https://github.com/doctrine-extensions/DoctrineExtensions

This bundles only performs the registration in symfony

stof avatar Jul 07 '23 14:07 stof