Question

I'm starting to learn Zend Framework 2 and really interested in modular system of this framework.
I want to make my own cms based on zf2 but I ran to a problem about module collaboration in zf2 , Let's clear my purpose with an example :

I use zfcuser module for user login and registration , Now I want to make a UserManagement Module upon this module to give administration over users.

I want to have a pagination in my UserManagement module to list users but I don't know how to achieve this, editing zfcuser module and adding pagination method is against software engineering methods and creating my user model and entities is against modular system!

Please help me to overcome this problem.

Was it helpful?

Solution

The only thing that ZfcUser is really only concerned with basic account creation and authentication.

Your instinct to create a UserManagement module on your own is correct. ZfcUser only cares that some User entity exists, and that it implements ZfcUser\Entity\UserInterface. There's one built in (ZfcUser\Entity\User), or you can define your own User entity class (that implements UserInterface), and configure ZfcUser to use it (see the user_entity_class configuration key in ZfcUser).

Your UserManagement module doesn't need to know anything about registration or authentication. It's just a module for managing User entities. And User entities are just plain old entities, like any other. You can query them, update them, list them, paginate those lists, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top