Invoke functions of another CFC or better create a parent CFC?

20 views
Skip to first unread message

Thorsten Eilers

unread,
Aug 1, 2012, 2:59:27 AM8/1/12
to cfwh...@googlegroups.com
Good morning cfwheelers.

I have two CFCs in controllers.
Offers.cfc and Demands.cfc

Offers.cfc has 10 functions
Demands.cfc has 6 functions but in the moment in Demands.cfc uses also functions from Offers.cfc like:

offersObject=CreateObject("component","Offers");
positiontypes = offersObject.getPositiontypes( session.locale );

Would it make more sense to create a parent cfc like OffersDemands.cfc and put the function getPositiontypes() in there and
Offers.cfc and Demands.cfc inherit the functions from OffersDemands.cfc?

tpet...@gmail.com

unread,
Aug 1, 2012, 8:38:48 AM8/1/12
to cfwh...@googlegroups.com
yes :)

Thorsten Eilers

unread,
Aug 1, 2012, 10:01:51 AM8/1/12
to cfwh...@googlegroups.com

Thanks Tony for your digital answer. ;-)

James Holmes

unread,
Aug 1, 2012, 6:01:33 PM8/1/12
to cfwh...@googlegroups.com

No, actually.

--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cfwheels/-/t4i1ZCkqBuMJ.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.

Kym Kovan

unread,
Aug 1, 2012, 7:48:01 PM8/1/12
to cfwh...@googlegroups.com
How about "yes and No" :-)

Use the ColdRoute plugin and put your controllers in a folder under the
main controllers folder and put a controller.cfc in there as well which
extends the parent controller.cfc. Then you can put all of your common
functions in that local controller cfc and still have the parent
functionality without messing with the main controller cfc.

Kym

On 2/08/2012 08:01, James Holmes wrote:
>
> No, actually.
>
> On Aug 1, 2012 10:38 PM, "tpet...@gmail.com
> <mailto:tpet...@gmail.com>" <tpet...@gmail.com
> <mailto:tpet...@gmail.com>> wrote:
>
> yes :)
>
> On Wednesday, August 1, 2012 2:59:27 AM UTC-4, Thorsten Eilers wrote:
>
> Good morning cfwheelers.
>
> I have two CFCs in controllers.
> Offers.cfc and Demands.cfc
>
> Offers.cfc has 10 functions
> Demands.cfc has 6 functions but in the moment in Demands.cfc
> uses also functions from Offers.cfc like:
>
> offersObject=CreateObject("component","Offers");
> positiontypes = offersObject.getPositiontypes( session.locale );
>
> Would it make more sense to create a parent cfc like
> OffersDemands.cfc and put the function getPositiontypes() in
> there and
> Offers.cfc and Demands.cfc inherit the functions from
> OffersDemands.cfc?
>
> --
> You received this message because you are subscribed to the Google
> Groups "ColdFusion on Wheels" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cfwheels/-/t4i1ZCkqBuMJ.
> To post to this group, send email to cfwh...@googlegroups.com
> <mailto:cfwh...@googlegroups.com>.
> To unsubscribe from this group, send email to
> cfwheels+u...@googlegroups.com
> <mailto:cfwheels%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/cfwheels?hl=en.
>
> --
> You received this message because you are subscribed to the Google
> Groups "ColdFusion on Wheels" group.
> To post to this group, send email to cfwh...@googlegroups.com.
> To unsubscribe from this group, send email to
> cfwheels+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cfwheels?hl=en.

--
Yours,

Kym


James Holmes

unread,
Aug 1, 2012, 7:53:03 PM8/1/12
to cfwh...@googlegroups.com
I added detail in the related thread, but the general idea was to also consider creating a service and injecting that service into whatever needs it.

--
Shu Ha Ri: Agile and .NET blog
http://www.bifrost.com.au/


    <mailto:cfwheels@googlegroups.com>.

    To unsubscribe from this group, send email to
    <mailto:cfwheels%2Bunsu...@googlegroups.com>.

    For more options, visit this group at
    http://groups.google.com/group/cfwheels?hl=en.

--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.

--
Yours,

Kym



--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+unsubscribe@googlegroups.com.

Thorsten Eilers

unread,
Aug 2, 2012, 8:48:41 AM8/2/12
to cfwh...@googlegroups.com

@all Thanks for your input.
For the meantime I include the function from an .cfm-File in Offers.cfc and Demands.cfc.

But I will have a look at the ColdRoute plugin.

Andy Bellenie

unread,
Aug 7, 2012, 6:50:36 AM8/7/12
to cfwh...@googlegroups.com
Keep it simple chaps...

--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cfwheels/-/If9H-4wi37wJ.

To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages