Injecting Settings into an Entity Object?

Just wanted to note a third and forth requirement to using enable
entity injection:

3) Set the entityInjection on the Autowire interceptor to true.
4) Set the eventHandling property on the entityService service to
true.

I had to change those settings to enjoy the goodness.

.brett

Should the service enable event handling by default?

Luis F. Majano
President
Ortus Solutions, Corp

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

I'm not sure, is there much of a performance hit for turning it on?

I couldn't figure out how to change that setting through the property
annotation, what is the convention for that? Right now I have

property name="itemService" inject="entityService:item"

So I had to set that setting to true somewhere else. Not ideal, but
I'm sure there is a convention that I didn't figure out yet. Is
there?

.brett

Don’t unde3rstnd brett

Luis F. Majano
President
Ortus Solutions, Corp

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

haha, well the entityService init() function takes 4 arguments. When
I wire that to my model using:

property name="itemService" inject="entityService:item"

how do I add the values for the other entityService init arguments in
the annotation.

This is the init function constructor:

  VirtualEntityService function init(required string entityname,
                    string queryCacheRegion,
                    boolean useQueryCaching,
                    boolean eventHandling){

Ah now I get it. Well, how would you like those to be represented via annotations?

The programmatic config is still in the works, where you will be able to declare those programmatically in configuration, but I would also like to offer this via annotations for faster development. Ideas? I have some, but would like to see the community’s ideas first.

Luis F. Majano
President
Ortus Solutions, Corp

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

Two years on, is there a recommended answer to my original question?

It depends on whether you expect it be a static injection, and where you’re expecting the variable to be coming from.

Well my original question was prompted by the need to get a user setting but my current need is for a Coldbox setting. Either way I would consider them static and only gathered on Application load.

Richard this is well covered in the docs, have you tried

property name=“someSetting” inject=“coldbox:setting:{setting}”;

Yes, that’s what I tried two years ago…

property name=“applicationRoot” inject=“coldbox:fwSetting:ApplicationPath” persistent=false;

It works in a service but not in an entity.

Are the Entities situated inside known ColdBox convention paths?

Yes, all the entities are in the location specified by this.ormSettings.cfclocation and the rest of the ORM functionality is working fine.

Sorry Richard that is not what I asked.

Sorry, I obviously misunderstood what you asked.

Can you rephrase the question?

What is the path of the entities?

Does that path use a known ColdBox convention?

For example, by default it is advised to store entities inside the ColdBox convention path model, does that help?

Hi Richard,

If you are loading entity with like this EntityLoad() then entity would not be autowired … you have to use VirtualEntityService to load entities for autowire …

Check postLoad event method … actually it only works with ColdBox virtualentityservice.

Richard,

I just re-read your original question, make sure you use persistent=false on the DI property for any Entity.