1

For a project, I use Api Platform and Mercure. I currently have a problem with the SoftDeleatable extension. Without this extension, when I delete an entity, Mercure receives the DELETE. But if I use the SoftDeleatable extension, the deletion is done correctly but Mercure does not receive the DELETE.

Code Entity:

/**
 * @ORM\Entity(repositoryClass=MatchesRepository::class)
 * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
 * @ApiResource(
 *     mercure=true,
 *     attributes={
 *          "normalization_context"={"groups"="read"}, 
 *          "denormalization_context"={"groups"="write"}
 *     },
 *     collectionOperations={
 *         "get",
 *         "post"={"security"="is_granted('ROLE_USER')"}
 *     },
 *     itemOperations={
 *         "get",
 *         "put"={"security"="is_granted('ROLE_ADMIN') or object.owner == user"},
 *         "delete"={
 *              "security"="is_granted('ROLE_ADMIN') or object.owner == user"
 *          },
 *     }
 * )
 */
class Matches
{

Just added mercure=true for enable mercure

PS: I doesn't test if change the DELETE function work or not but SoftDeleatable do it normally :/

Lucas
  • 38
  • 3
  • Does it update? Because you don't delete entity when softdeletable is active. Technically, you update the 'deletedAt' field. – Stephan Vierkant Jul 26 '21 at 07:39
  • See this issue for context: https://github.com/doctrine-extensions/DoctrineExtensions/issues/505. – Stephan Vierkant Jul 26 '21 at 08:03
  • Ok i see what u mean but when i send a DELETE request, its a 204 response, so element deleted, why mercure don't react to DELETE. maybe u right and that just bypass DELETE method update the field and send 204 response :/ – Lucas Jul 26 '21 at 08:56
  • And i'm gonna check issue, thanks – Lucas Jul 26 '21 at 08:58

0 Answers0