zikula-modules / DizkusModule

Official repository for Dizkus, a fully integrated forum solution for Zikula 1.4+
21 stars 7 forks source link

Remove ForumUsers table #326

Open Kaik opened 7 years ago

Kaik commented 7 years ago

Dizkus since the beginning have separate users table which is nothing more than a Zikula users "duplicate" (one to one relation) - all users in the forum_users table are Zikula users but not all Zikula users are in forum users table - only those users that interacted with the forum are in forum users table. I think it exists due to historical reasons because Dizkus was based on BBForum this table most probably came from BBForum or there was intention at the beginning to make forum standalone or something like that. Currently, there is no reason to keep it unless someone will come up with a good one. This will not be done before everything else work and both v5 and v6(master) will be released so not soon.

craigh commented 7 years ago

I remember wrestling with the same decision. You need some way to track all the information in the entity https://github.com/zikula-modules/DizkusModule/blob/master/Entity/ForumUserEntity.php So... you either use a related entity or user attributes which is essentially the same thing (a related entity). So - it seems like a lot of work for not much benefit

Kaik commented 7 years ago

There is as well "proxy" class/service (I do not know if proxy is a good word for it) https://github.com/zikula-modules/DizkusModule/blob/master/Manager/ForumUserManager.php This class/service is used in most templates and I tried to use it everywhere it is intended to make entity more "smart" - it exists between controller/view and doctrine so controller can be thin it frees doctrine entities from using services and templates from repetitive logic. If implemented properly everywhere it might reduce the amount of work. Another thing is that some pieces of information are stored in forum users entity and some like signature/avatar in user attributes which is another reason to remove forum users table completely. On the other hand, back in the day when I was working on that part, I remember thinking that ForumUserEntity helps with something but now I have no idea what it was...hmm most probably relations https://github.com/zikula-modules/DizkusModule/blob/master/Entity/ForumUserEntity.php#L89