Agenda: Allow to delete registry in agenda_event_invitee when deleting user #5977

pull/6052/head
Angel Fernando Quiroz Campos 10 months ago
parent 7ea28f8df6
commit 7f75d7066d
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 5
      main/install/configuration.dist.php
  2. 2
      src/Chamilo/CoreBundle/Entity/AgendaEventInvitee.php

@ -459,6 +459,11 @@ ALTER TABLE personal_agenda ADD agenda_event_invitation_id BIGINT DEFAULT NULL,
ALTER TABLE personal_agenda ADD CONSTRAINT FK_D8612460AF68C6B FOREIGN KEY (agenda_event_invitation_id) REFERENCES agenda_event_invitation (id) ON DELETE CASCADE;
CREATE UNIQUE INDEX UNIQ_D8612460AF68C6B ON personal_agenda (agenda_event_invitation_id);
*/
// After Chamilo v1.11.30 it's necessary to change the foreign key in agenda_event_invitee.user_id so that the record is deleted when deleting a user
/*
ALTER TABLE agenda_event_invitee DROP FOREIGN KEY FK_4F5757FEA76ED395;
ALTER TABLE agenda_event_invitee ADD CONSTRAINT FK_4F5757FEA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;
*/
// Then add the "@" symbol to AgendaEventInvitation and AgendaEventInvitee classes in the ORM\Entity() line.
// Then uncomment the "use EventCollectiveTrait;" line in the PersonalAgenda class.
//$_configuration['agenda_collective_invitations'] = false;

@ -38,7 +38,7 @@ class AgendaEventInvitee
/**
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected ?User $user;

Loading…
Cancel
Save