This repository was archived by the owner on Mar 13, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
src/system/UsersModule/Entity Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,16 @@ public function persistAndFlush(UserEntity $user)
4141
4242 public function removeAndFlush (UserEntity $ user )
4343 {
44- foreach ($ user ->getAttributes () as $ attribute ) {
45- // this should be unnecessary because cascade = all but MySQL 5.7 not working with that
46- $ this ->_em ->remove ($ attribute );
47- }
44+ // the following process should be unnecessary because cascade = all but MySQL 5.7 not working with that (#3726)
45+ $ qb = $ this ->_em ->createQueryBuilder ();
46+ $ qb ->delete ('Zikula\UsersModule\Entity\UserAttributeEntity ' , 'a ' )
47+ ->where ('a.user = :userId ' )
48+ ->setParameter ('userId ' , $ user ->getUid ());
49+ $ query = $ qb ->getQuery ();
50+ $ query ->execute ();
51+ // end of theoretically unrequired process
52+
53+ $ user ->setAttributes (new ArrayCollection ());
4854 $ this ->_em ->remove ($ user );
4955 $ this ->_em ->flush ($ user );
5056 }
Original file line number Diff line number Diff line change @@ -496,9 +496,9 @@ public function getAttributeValue($name)
496496 /**
497497 * set the attributes for the user
498498 *
499- * @param UserAttributeEntity $attributes the attributes for the user
499+ * @param ArrayCollection $attributes the attributes for the user
500500 */
501- public function setAttributes ($ attributes )
501+ public function setAttributes (ArrayCollection $ attributes )
502502 {
503503 $ this ->attributes = $ attributes ;
504504 }
@@ -547,6 +547,11 @@ public function getGroups()
547547 return $ this ->groups ;
548548 }
549549
550+ /**
551+ * set the groups for the user
552+ *
553+ * @param ArrayCollection $groups the groups for the user
554+ */
550555 public function setGroups (ArrayCollection $ groups )
551556 {
552557 $ this ->groups = $ groups ;
You can’t perform that action at this time.
0 commit comments