File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -64,3 +64,19 @@ $aclSetup->setUpEntityManager($entityManager, $aclLocator);
6464
6565These listeners handle different things, like registering your role and user classes, and registering
6666a listener that will act when new resources/entities are created (to cascade authorizations).
67+
68+
69+ ## Cascade delete
70+
71+ To be as efficient as possible, MyCLabs\ACL uses ` ON DELETE CASCADE ` at database level.
72+
73+ For example, when a role is removed, all of its authorizations will be deleted in cascade by MySQL/SQLite/…
74+ That allows to bypass using Doctrine's "cascade remove" which loads all the entities in memory (there could
75+ be thousands of authorizations).
76+
77+ However this means ** your database must support CASCADE operations** . MySQL and PostgreSQL support it,
78+ but SQLite usually [ needs a configuration step] ( http://www.sqlite.org/foreignkeys.html#fk_enable ) :
79+
80+ ``` php
81+ $entityManager->getConnection()->executeQuery('PRAGMA foreign_keys = ON');
82+ ```
You can’t perform that action at this time.
0 commit comments