I think I ran into this one as well. Try removing required="true" from
> I'm not sure why the script version works and the tag-based one doesn't, and
> it would probably be good to find out. But as a pragmatist, I'd say just use
> the script version since it is vastly superior to the tag version in terms
> of layout, space, and ease of scanning.
> Also, mapped superclass only applies to ORM CFCs. While the event handler
> CFCs are used as part of the ORM framework, they are not entities. So you'd
> just use normal inheritance here.
> Brian
> On Tue, Jun 28, 2011 at 4:09 PM, Bernhard Döbler <bard...@gmail.com> wrote:
> > Hi,
> > I'd like to have a CFC handling ORM events setting updated-timestamps
> > on update and the like.
> > I keep getting the error:
> > ormcfcs.ormeventhandler is not a valid ORM event handler.
> > It must implement interface cfide.orm.IEventHandler
> > in my Application.cfc I defined
> > <cfset this.ormsettings.eventHandling = true>
> > <cfset this.ormsettings.eventHandler="ormcfcs.ormeventhandler">
> > <cfset this.ormsettings.cfclocation = "/ormcfcs/">
> > and put the following ormeventhandler.cfc in the ormcfcs folder
> > <cfcomponent implements="CFIDE.orm.IEventHandler">
> > <cffunction name="preInsert" access="public" returntype="void"
> > output="false" hint="I run before this entity is inserted.">
> > <cfargument name="entity" type="any" />
> > <!---
> > Set the date/time properties. This way, we can
> > keep track of the time at which this object was
> > created / inserted.
> > --->
> > <cfset this.setangelegt_datum( Now() ) />
> > <cfset this.setgeaendert_datum( Now() ) />
> > <!--- Return out. --->
> > <cfreturn />
> > </cffunction>
> > <cffunction name="postLoad" access="public" returntype="void"
> > output="false" hint="I run after this entity is loaded.">
> > <cfargument name="entity" type="any" />
> > <!--- Return out. --->
> > <cfreturn />
> > </cffunction>
> > <cffunction name="postDelete" access="public" returntype="void"
> > output="false" hint="I run after this entity is deleted.">
> > <cfargument name="entity" type="any" />
> > <!--- Return out. --->
> > <cfreturn />
> > </cffunction>
> > <cffunction name="preLoad" access="public" returntype="void"
> > output="false" hint="I run before this entity is loaded.">
> > <cfargument name="entity" type="any" />
> > <!--- Return out. --->
> > <cfreturn />
> > </cffunction>
> > <cffunction name="preDelete" access="public" returntype="void"
> > output="false" hint="I run before this entity is deleted.">
> > <cfargument name="entity" type="any" />
> > <!--- Return out. --->
> > <cfreturn />
> > </cffunction>
> > <cffunction name="preUpdate" access="public" returntype="void"
> > output="false" hint="I run before this entity is updated.">
> > <cfargument name="entity" type="any" />
> > <!--- Define the arguments. --->
> > <cfargument name="oldData" type="struct" required="true"
> > hint="I am
> > the collection of data held over from the load time." />
> > <!---
> > Set the date/time properties. This way, we can
> > keep track of the most recent time at which this
> > object was updated.
> > --->
> > <cfset this.setgeaendert_datum( Now() ) />
> > <!---
> > Return out. NOTE: If this method return TRUE, then
> > the update is cancelled.
> > --->
> > <cfreturn />
> > </cffunction>
> > <cffunction name="postUpdate" access="public" returntype="void"
> > output="false" hint="I run after this entity is updated.">
> > <cfargument name="entity" type="any" />
> > <!--- Return out. --->
> > <cfreturn />
> > </cffunction>
> > <cffunction name="postInsert" access="public" returntype="void"
> > output="false" hint="I run before this entity is inserted.">
> > <cfargument name="entity" type="any" />
> > <!--- Return out. --->
> > <cfreturn />
> > </cffunction>
> > </cfcomponent>
> > It works, when I use the following cfc in script-notation.
> > component implements="CFIDE.orm.IEventHandler" {
> > public void function preInsert(any entity){
> > arguments.entity.setangelegt_datum(now());
> > arguments.entity.setgeaendert_datum(now());
> > }
> > public void function postLoad( any entity){
> > arguments.entity.setgeaendert_datum(now());
> > }
> > public void function postDelete(any entity){
> > }
> > public void function preLoad( any entity){
> > }
> > public void function preDelete( any entity) {
> > }
> > public void function preUpdate( any entity, Struct oldData){
> > }
> > public void function postUpdate( any entity){
> > }
> > public void function postInsert( any entity){
> > }
> > }
> > Are you using ORM events to modify data preUpdate? Have you used
> > mappedSuperClass to define event handlers?
> > Best,
> > Bernhard
> > --
> > You received this message because you are subscribed to the Google Groups
> > "cf-orm-dev" group.
> > To post to this group, send email to cf-orm-dev@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cf-orm-dev+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/cf-orm-dev?hl=en.