getting to grips with ORM and ColdBox. something I don't understand. I
am trying to do everything via my service in my model however I have
an issue with this I wrote...
void function checkCredentials(event) output=false{
var rc = event.getCollection();
rc.ouserbean = userService.new();//new object
populateModel(rc.ouserbean);//populate object from scope
1) findAllWhere, is this CF9 ORM as I don't need the function in my
service to work. "it just works!" I want to hit my service first how
do I do that? adding the function findAllWhere to my service does
nothing
2) why populating my model from the url scope I dont pass it as a
whole, should I not?
userService its my own, I am using the base BaseORMService.cfc also as
it needed right? findAllWhere is a CB thing from what I am reading not
CF9 ORM right?
countWhere is not in my userService.cfc so where and how does it
inherit it? as my own userService.cfc is access remotely by a asp.NET
app i have I want countWhere function to be in my own service
otherwise my other app can not accees it.
:P) just trying to get my head around this having some free time this
week and its on my list to learn.
Ok, you are on the right track but you are injecting the wrong CFC.
This →
property name=“userService” inject=“entityService:user”;
Is injecting a virtual service layer object based on the User entity and the base ORM service that ColdBox provides. This gives you a very nice generic service layer binded to the User entity.
The UserService you created does nothing as it is never injected in your handlers or used. Do you get it?
ok so.... entityService is a virtual service layer thats injected with
my "user" object and is made available in my login.cfc handler, by
using the above code, thats really cool it i got that right.
but how do I go about overriding, decorating some functions of this
virtual layer i.e. use my own service layer that still extends/
inherits CB ORM and/or the virtual layer. I want my service layer to
be open remotely/exposed, I want to write my own custom functions or I
may want to extend overwrite a few entityService functions. I want all
my service layers organised, one for login one for security, one for
campaigns etc.
is this possible?
Is injecting a virtual service layer object based on the User entity
and the
base ORM service that ColdBox provides. This gives you a very nice
generic
service layer binded to the User entity.
That’s absolotuely right. The base ORM service follows the template pattern. This way you can template it out and create more concrete based classes but you get ALL the functionality there already. I have definitely seen an incredible boost in my development time as the base service layers for ORM in ColdBox take me about 85 to 90% there.