Coldbox 3.6.0 - Entity injection

41 views
Skip to first unread message

Jason Durham

unread,
Mar 10, 2013, 7:11:05 PM3/10/13
to col...@googlegroups.com
This is my first attempt at setting up entity injection using Wirebox.  I've bounced around through several pages on the wiki and watched the preso (which is outdated it seems).

I'm not sure if it's relevant, but I'm using a mapping for '/model'.

App.cfc snippet....
----------------------------------------------------
this.ormEnabled = true;
this.datasource = "test"; 
this.ormSettings = {
cfcLocation = "model",
dbcreate = "update",
eventHandling = true,
eventHandler = "model.ORMEventHandler"
};

ORMEventHandler snippet...
---------------------------------------------------
component extends="coldbox.system.orm.hibernate.WBEventHandler" 
{
         //empty
}

Coldbox.cfc snippet...
------------------------------------------------------
orm = {
injection = {
enabled = true,
}
};

User.cfc (entity) snippet...
------------------------------------------------------
component persistent="true" table="Users" extends="model.BaseORMEntity" discriminatorcolumn="disc" 
{
property name="Logger" inject="logbox:logger:{this}" persitent=false scope="this";
//Persistent
property name="id" fieldtype="id" generator="native";
property name="firstname" ormtype="string" length="100" notnull="true";
property name="lastname" ormtype="string" length="100" notnull="true";

//more stuff here

}


When I dump User.cfc, I see a property called Logger but it only contains an empty string.  What have I missed?

Jason Durham

Jason Durham

unread,
Mar 10, 2013, 7:35:25 PM3/10/13
to col...@googlegroups.com
Nevermind. :)

I was instantiating a new entity without calling wirebox.autowire(entity);

Jason Durham

br...@bradwood.com

unread,
Mar 11, 2013, 3:13:18 PM3/11/13
to col...@googlegroups.com
Are you using WireBox to initially create the objects?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 


--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jason Durham

unread,
Mar 11, 2013, 3:39:05 PM3/11/13
to col...@googlegroups.com
I am not and hadn't considered it.  I'm using my own abstract ORM gateway currently but I'm open to other suggestions.

Jason Durham

Aaron

unread,
Mar 12, 2013, 11:11:32 AM3/12/13
to col...@googlegroups.com, ja...@durhamcons.com
Speaking of gateways, http://wiki.coldbox.org/wiki/Extras:BaseORMService.cfm has lots of ORM goodies.

Jason Durham

unread,
Mar 12, 2013, 11:48:11 AM3/12/13
to col...@googlegroups.com
Thanks for the link. I'm aware of many of the ORM goodies but I'm not ready to make the jump in depending on them. I'd like to keep my code portable and I think that comes close to crossing the line on relying on the framework too heavily.

Jason Durham

br...@bradwood.com

unread,
Mar 12, 2013, 11:49:53 AM3/12/13
to col...@googlegroups.com
Give in to the dark side.... :)

Aaron

unread,
Mar 12, 2013, 12:04:41 PM3/12/13
to col...@googlegroups.com, ja...@durhamcons.com
Coldbox is good for you...

http://imgur.com/gallery/uzIx6Jp
Reply all
Reply to author
Forward
0 new messages