Inject a model in another model?

I’m having an issue where I am trying to access a model inside of another model. In my team model I’m trying to use my email model.

My team model looks like

…some code here

if (LOCAL.rs.returnCode neq “error”) emailService.emailUnfreeze(LOCAL.rs);

returnLOCAL.rs;

my wirebox.cfc

map

(“emailService”).to(“model.emailService”).asSingleton();

I can access the email model just fine from a handler so I know it is wired up. Any ideas or suggestions?

Thanks.

Hy there Jonathan,

- If you only want to acces your email, why don you save it in the RC
(recuest contest) ?
- or you can create a plugin (CFC) where you can request for special
information, from within any model or view

I think there is not point in coldbox to try and extend a model within
a model.

Regards,
Felipe Serrano

Technically you are not extending a model with a model so be careful about that misconception.

To the original poster, you don’t say if you get an error or not?

Also if you have something in your model folder, you do not need to wire it up like that. You can remove that binding and it will still work. As long as you place the singleton annotation / attribute in your component it will still work.