hi all,

 

I have chosen the worst weekend to need a quick answer! Oh well, please help

i have a vehicle.cfc, which has a composite dao as one of its properties,
the dao itself has a composite database cfc

//vehicle cfc

instance.type = 'car';
instance.dao = createobject('component','vehicledao');


//dao cfc
instance.database = createobject('component','database');
CRUD methods

//database cfc
init (){
instance.dsn = 'mydsn';
instance.username = 'un';
instance.password = 'pw';
}



my question is, how do i reference the properties of the database cfc, and
the methods of the dao, from within the vehicle cfc it self, and from
outside of the cfc from the controller

Also, how do i reference the instance scope of the vehicle cfc, from
within the vehicle dao.

Does a composition like this all share the same variables (instance)
scope?

I realise that the above method also breaks encapsulation, so would i pass
in objects to the init method of the vehicle cfc. Would this pass a
reference to an object outside of vehicle cfc or would the whole object be
passed into the vehicle cfc?

Sorry to ask so many (probably simple) questions, i am reading a good oo
book for php and trying to apply the principles to cf, favour composition over inheritance,
 

many thanks

Jamo

---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to