inject Syntax and EntityService

One of the things I often get confused about and have a hard time
finding in the vast array of documentation available is how and why
syntax like this is meaningful:

  property name="taskService" inject="entityService:Task";

Bearing in mind, I am a newcomer to CB, when I see this in one of the
sample applications, my first question is how does "inject" work,
where do I find it in the documentation? My next question is what is
"entityService" when I see no templates, cfcs or directories with that
name and finally, if I look at anything named "task" (in the
ormexample I'm looking at there is a taskservice.cfc (model) a
task.cfc (model) and a Tasks.cfc (handler) but none of them have a
"deleteById" which is used in the code.

I still must be misunderstanding something very fundamental about how
CB works to not be able to recognize what this is, how to find more
information based on what it is or to even be able to guess how it is
being used at run time.

Can someone shed some light on this for me?

Thanks,
Mike

Ok...strike that...my frustration was getting the better of me...at
least in part, I see what that is all about. What I had not read up
on much (or at least recently) is what AutoWiring does. So I'm still
left with where this "deleteById" method exists.

Frustrated but really excited too.

Mike

AH HA! The autowire dependency injection keyword entityService
automatically extends VirtualEntitySerivce which has a generic method
for deleting by id. I love it when things start to make sense...the
month of reading was well worth it.

I realize this seems like I'm talking to myself, but it helps...but
please, if anyone reading this, of course, once you stop laughing at
me, wants to correct me or affirm anything I've put out here, please
please do.

Thanks,
Mike

Mike,

This is totally understandable. Especially digesting not only MVC concepts but also DI concepts. The “inject” annotation should strike a chord and mean “Dependency Injection”. Here is the guide for it: http://wiki.coldbox.org/wiki/WireBox.cfm
We also have a Dependency Injection free training PDF: http://ortus-public.s3.amazonaws.com/cbox202-unit1-3.pdf
That gives you a great primer of why DI and how to use DI.

With that said, the inject annotation can have values and these values are namespaced or collected into different actions that happen: http://wiki.coldbox.org/wiki/WireBox.cfm#Injection_DSL

THe one you saw was the ColdBox ORM services namespace. In order to provide developers with an upper hand when working with CF ORM, we developed a set of ORM services that help you 80-90% of the way. That is why we call one a base ORM service layer, Virtual ORM service layer, which binds itself to an ORM entity, ColdBox Hibernate Criteria Builder.

The ORM services are cool because they are service layers built for you with tons of helpful methods you can easily extend. Not only does it extend on the CF orm capabilities, but also on native Hibernate capabilities that are not exposed by CF.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano