Sorry if this has been asked I've been searching documentation and stack overflow and can't find it being solved.
Here is my scenario. I have a model for a league, this model has many teams, each team has many team_members.
I have a view that is displaying a selection list of leagues and I want to disable the selection of leagues that the current logged in user is already registered for. I need a quick way in a view while iterating through leagues and displaying UI related to the league to determine if this leagues selection should be disabled. What I need is a simple way to query the Leagues object and provide a user_id to have it give me a true false response. Basically a model based helper function to help me determine what UI I should present.
I've been pouring over the documentation and trying to figure out where my simple method needs to reside which will just query all team_members with a user_id and the desired league_id.
- Doesn't seem to go in Helpers because I can't figure out how a view helper would access a model Table object.
- Doesn't seem to go in the models entity object because I don't have access to the model to perform a find() on the table object from a method in my entity class.
- I don't want this to go into the controller and have to build some sort of array I reference and set for the view to have available.
- It doesn't seem right to make a behavior. Why do I need a whole class for one method that is for a specific model and not to be re-used for multiple.
Am I missing something big or is this partially by design to keep code in proper places and for me specifically not to do what I want to do?
It seems to me there should be a simple way to create custom model logic but I can't figure out where I should be doing it.