--
You received this message because you are subscribed to the Google Groups "Object-Oriented Programming in ColdFusion" group.
To view this discussion on the web visit https://groups.google.com/d/msg/coldfusionoo/-/9PzxL1vg928J.
To post to this group, send email to coldfu...@googlegroups.com.
To unsubscribe from this group, send email to coldfusionoo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/coldfusionoo?hl=en.
You can probably rig ColdSpring to do this for you, though historically people say don't do that with transient objects but rather with services and whatever. I think a lot of the pain there has been relieved with ColdSpring 2 (still alpha? the web site is down again). I would recommend making your own transient ORM bean factory. It's not that hard. It should probably have 2 public methods, something like: getNewEntity(string name) and getExistingEntity(string name, numeric id). You can inject your other services in there however you like; I would suggest something as simple as checking to see if a known setter exists, then try to set the property. It's cheap and effective.nathan strutz[www.dopefly.com] [hi.im/nathanstrutz] [about.me/nathanstrutz]
On Tue, May 15, 2012 at 9:19 AM, Phil Cruz
In my (fw1) app using cf-orm, when I need an entity I have been simply doing entityNew() or entityLoadByPK(). This has been fine as mostly it's been CRUD operations. Get the entity, update properties, save it. Now I find the objects needing more "smarts" and having behavior. I'm wanting to inject services into the entities to do this. I'm using ColdSpring but injecting properties into cf-orm entities with CS is not straightforward. So I'm leaning towards using services to handle object creation. Couple of questions:
1. Do people generally use services for object creation from the get go head off this situation. i.e. is this i best/recommend practice to start out with?2. What are some recommendations to implement this. I don't want to create a service for every entity just for object creation. So I generic wrapper function in one of the services entityNew("some object"), that basically calls EntityNew() and based on the object type passed in sets other properties? Or is there some other framework/utility that can help with this?Thanks,Phil
--
You received this message because you are subscribed to the Google Groups "Object-Oriented Programming in ColdFusion" group.
To view this discussion on the web visit https://groups.google.com/d/msg/coldfusionoo/-/9PzxL1vg928J.
To post to this group, send email to coldfu...@googlegroups.com.
To unsubscribe from this group, send email to coldfusionoo+unsubscribe@googlegroups.com.