What would you refer to this object as
Posted: Thu Nov 27, 2008 11:25 pm
EDIT| Just occured to me...I'm looking for a name to give this object so the accessor method makes more sense. Association is what the relationship is...but ideally I"m looking for a definition or term to describe the methods purpose, such like:
I have two models each of which maps a separate database table.
One is for holding records and the other table is for group associations which record can have. It's a one to many relationship, where one record can have multiple groups.
The models map these two tables and the association model is never to be used independently but strictly through the main objects API.
If you want to add a group to a specifc record you would access the secondary object with something like:
In C++ I might define the secondary class as a private and make it a friend class of primary model so only it ever had access to this model object. Alternatively after a while, if it was clear it would never be called externally, I would implement the model as a nested private class, of course neither are available in PHP. 
What or how would you define this secondary object according to pattern terminology? I personally wouldn't consider it a helper object as helpers I tend to think of as generic objects which are more reusable as opposed to being bound to a specific model through composition.
The secondary model is always used as a composite in the primary and it's access is restricted to accessors/mutators.
I Googled broker quickly as it seemed to make sense however (according to M$) it's more for distributed systems, which this is not nessecarily so.
Perhaps an association object?
Cheers,
Alex
Code: Select all
getGroupListHelper()
getGroupListObject()
getGroupListModel() // Perhaps the best choice? Unless you have a cooler name <!-- s:P --><img src=\"{SMILIES_PATH}/icon_razz.gif\" alt=\":P\" title=\"Razz\" /><!-- s:P -->
One is for holding records and the other table is for group associations which record can have. It's a one to many relationship, where one record can have multiple groups.
The models map these two tables and the association model is never to be used independently but strictly through the main objects API.
If you want to add a group to a specifc record you would access the secondary object with something like:
Code: Select all
$model = new Main_Model();
$model->getSecondaryModel()->createGroup($name);What or how would you define this secondary object according to pattern terminology? I personally wouldn't consider it a helper object as helpers I tend to think of as generic objects which are more reusable as opposed to being bound to a specific model through composition.
The secondary model is always used as a composite in the primary and it's access is restricted to accessors/mutators.
I Googled broker quickly as it seemed to make sense however (according to M$) it's more for distributed systems, which this is not nessecarily so.
Perhaps an association object?
Cheers,
Alex