I was wondering if it would be possible in any way to use a modelService for multiple instances of a single model.
Imagine you have:
- Customer.cfc, with properties: name, email, id
- Basket.cfc, with properties: id, price, customer
- customerService.cfc, that services Customer.cfc via wirebox, that has a method setEmail()
customerService.cfc has a property:
the binding for this happens in the correct moduleConfig:
binder.map(“customer”).to("#moduleMapping#.model.customer")
.into(binder.scopes.session)
.threadSafe();
binder.map(“customerService”).to("#moduleMapping#.model.customerservice")
.into(binder.scopes.request)
.threadSafe();
This way the setEmail() method does te following:
<cfset customer.setEmail(arguments.emailAddress) />
Now, What I’m asking is, how can I still use setEmail() for the customer instance in my basket model?
Best regards,
Mikaël