Skip to content

Commit 7f75d70

Browse files
committed
Agenda: Allow to delete registry in agenda_event_invitee when deleting user #5977
1 parent 7ea28f8 commit 7f75d70

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

main/install/configuration.dist.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@
459459
ALTER TABLE personal_agenda ADD CONSTRAINT FK_D8612460AF68C6B FOREIGN KEY (agenda_event_invitation_id) REFERENCES agenda_event_invitation (id) ON DELETE CASCADE;
460460
CREATE UNIQUE INDEX UNIQ_D8612460AF68C6B ON personal_agenda (agenda_event_invitation_id);
461461
*/
462+
// 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
463+
/*
464+
ALTER TABLE agenda_event_invitee DROP FOREIGN KEY FK_4F5757FEA76ED395;
465+
ALTER TABLE agenda_event_invitee ADD CONSTRAINT FK_4F5757FEA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;
466+
*/
462467
// Then add the "@" symbol to AgendaEventInvitation and AgendaEventInvitee classes in the ORM\Entity() line.
463468
// Then uncomment the "use EventCollectiveTrait;" line in the PersonalAgenda class.
464469
//$_configuration['agenda_collective_invitations'] = false;

src/Chamilo/CoreBundle/Entity/AgendaEventInvitee.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AgendaEventInvitee
3838

3939
/**
4040
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User")
41-
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
41+
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
4242
*/
4343
protected ?User $user;
4444

0 commit comments

Comments
 (0)