PHP (Zend FW) Objects hierarchy question
I am building a kind of personinfo application on the Zend Framework and am not sure where to put some objects where.
I have the following entities :
Persons (inherits from Families)
(The above is clear to me)
One person can (and does not have to) be in multiple Studygroups.
And one person can (and does not have to) be in multiple Taskgroups
Ths most logical to me would be to let Studygroups and Taskgroups be an objectarray in the PersonsObject, but.....
If I want to have a list of e.g. all persons belonging to Studygroup with id = 5 I would need to fill the PersonObject with all persons from the db and filter on Person->getStudyGroups to check if the groupid is in that array.
Or should I fill both those groups when getting a Person AND use seperate classes where I use Persons as an objectarray in a Studygroup object ?
I use seperate tables for both connecting person to taskgroup as person to studygroup :
person_id (INT, PRIMARY), studygroup_id (INT, PRIMARY), is_active (Bool)
Preferable not by using queries avoiding the functionality of the tablemapping from the Zend Framework