DI on Models

Ok so I am obviously doing something wrong but I am unable to inject a UDF into my model.

I have a cart.cfc and a cartService.cfc in my model folder. I’m using ColdBox 3.8.

I’m using the VirtualEntityService to link cart to my database table cart.

However I’m trying to inject the coldbox:UDF:formatTelephone into the cart.cfc model and it keeps returning null.

I’ve tried it multiple ways but nothing seems to work.

I move it to the cartService.cfc and it works perfectly.

Can you point me in the direction of things to check??

I don’t think there is a :udf injection DSL

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Is formatTelephone validation rules?

Why not use the validation feature of ColdBox instead?

Not that I know of. We used to spoof it the last place I worked by creating a model called “UDF” and we’d use the “model:name:method” DSL with onMissingMethod so I’d inject something like this:

property name=“foo” inject=“model:UDF:formatTelePhone”;

That would try to call a formatTelePhone method in my UDF.cfc whose onMissingMethod would then fire, include the UDFLIbraries, and return a reference to variables[MissingMethodName].

It basically let us just return a single UDF from our UDF library. It would be kind of handy to have built-in support for that.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com