I would add the calendar array from an Event service layer method.

This way you have the option to create fully loaded events with arrays of 
calendars when needed but can also easily create an Event without the extras.

I would use Coldspring to inject an EventGateway and CalendarGateway into your 
EventService (or if you need more abstraction inject a CalendarService but this 
may be overkill)

Then you can have a method in your service cfc called getEvent that takes an 
event id argument.
It then creates and Event bean and passes it to your EventDAO's read() method. 
This populates your bean.
The service method then runs a method on CalendarGateway (or CalendarService) 
called getCalendarsAsArray() either taking your event id or the event bean as 
an argument.
This returns your array of calendar objects.
Then use a setter method to give the array to your Event bean ie <cfset 
objEvent.setCalendars(calendarArray) />
Then cfreturn the loaded bean.

I prefer this approach to the Event bean and/or DAO dealing with it as 
sometimes you may want an Event without the extra baggage of the Calendar (and 
maybe other) arrays.

I'm new to this too so wait for others with better suggestions :-)

Alan
________________________________________
From: [email protected] [EMAIL PROTECTED] On Behalf Of Stephen Judd 
[EMAIL PROTECTED]
Sent: 26 March 2008 14:58
To: [email protected]
Subject: [CFCDEV] Composing?

I'm taking my first plunge into a fully OO application and have what I think is 
a simple question, though I haven't found the answer through searching:

I'm developing an events calendar.  An event can be on more than one calendar, 
so when I display an individual event, I want to also display which calendars 
it's on.

So, when I construct my event object (I know, confusing name) what's the best 
way to grab an array of the calendars it occurs on?  I'm thinking the array 
could be a property of the event, but I'm not sure that my event should be 
asking the calendarManager for the array directly.

Options I've contemplated:

Have the event object just query the database and populate the array itself.

Have the event object ask the calendarManager for the array.

Pass the array into the constructor when creating the event object.


Any thoughts?  is this where I need to start using and learning ColdSpring?

Thanks, Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to