Stab in the dark here, but are you trying to run this CFC directly?  It's
not intended to be run directly, but instead will be run automagically on
entity CRUD actions as long as it's specified in the Application.cfc's
"this.ormsettings.eventhandler".

Like Matt said, sometimes error line numbers are misleading, so it could be
something generic like that going on.  Since you are reading John's book I
assume you are NOT running it directly, but just thought I would check to
be sure.

-Cameron

On Thu, Dec 29, 2011 at 12:02 PM, Tom Small <[email protected]> wrote:

>
> Hi Matt
>
> Thanks for your reply. I am following a book by John Whish "ColdFusion
> ORM" and have pasted his exmaple;
>
> component implements="cfide.orm.IEventHandler"
> {
> public void function preLoad( any entity )
> {
> logEvent( "preload", arguments.entity );
> }
> public void function postLoad( any entity )
> {
> logEvent( "postload", arguments.entity );
> }
> public void function preInsert( any entity )
> {
> logEvent( "preinsert", arguments.entity );
> var timestamp = now();
> if ( StructKeyExists( arguments.entity, "setCreated" ) )
> {
> arguments.entity.setcreated( timestamp );
> }
> if ( StructKeyExists( arguments.entity, "setUpdated" ) )
> {
> arguments.entity.setupdated( timestamp );
> }
> }
> public void function postInsert( any entity )
> {
> logEvent( "postinsert", arguments.entity );
> }
> public void function preUpdate( any entity, Struct oldData )
> {
> if ( StructKeyExists( arguments.entity, "setUpdated" ) )
> {
> arguments.entity.setupdated( Now() );
> }
> logEvent( "preupdate", arguments.entity );
> }
> public void function postUpdate( any entity )
> {
> logEvent( "postupdate", arguments.entity );
> }
> public void function preDelete( any entity )
> {
> logEvent( "predelete", arguments.entity );
> }
> public void function postDelete( any entity )
> {
> logEvent( "postdelete", arguments.entity );
> }
> private void function logEvent( required string event, required
> CFC )
> {
> var message = "Entity: #getMetaData( cfc ).fullname#, Event:
> #event#";
> WriteLog( type="event", file="ormevent.log", text=message );
> }
> }
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349252
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to