File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/Symfony/Component/Security/Acl/Dbal Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,18 @@ public function deleteAcl(ObjectIdentityInterface $oid)
108108 }
109109 }
110110
111+ /**
112+ * Deletes the security identity from the database.
113+ * ACL entries have the CASCADE option on their foreign key so they will also get deleted
114+ *
115+ * @param SecurityIdentityInterface $sid
116+ * @throws \InvalidArgumentException
117+ */
118+ public function deleteSecurityIdentity (SecurityIdentityInterface $ sid )
119+ {
120+ $ this ->connection ->executeQuery ($ this ->getDeleteSecurityIdentityIdSql ($ sid ));
121+ }
122+
111123 /**
112124 * {@inheritDoc}
113125 */
@@ -595,6 +607,21 @@ protected function getSelectSecurityIdentityIdSql(SecurityIdentityInterface $sid
595607 );
596608 }
597609
610+ /**
611+ * Constructs the SQL to delete a security identity.
612+ *
613+ * @param SecurityIdentityInterface $sid
614+ * @throws \InvalidArgumentException
615+ * @return string
616+ */
617+ protected function getDeleteSecurityIdentityIdSql (SecurityIdentityInterface $ sid )
618+ {
619+ $ select = $ this ->getSelectSecurityIdentityIdSql ($ sid );
620+ $ delete = preg_replace ('/^SELECT id FROM/ ' , 'DELETE FROM ' , $ select );
621+
622+ return $ delete ;
623+ }
624+
598625 /**
599626 * Constructs the SQL for updating an object identity.
600627 *
You can’t perform that action at this time.
0 commit comments