I'm messing around with the event gateways in order to automatically
set my table audit fields (created/updated by/date) in the CF ORM and
was getting weird behavior which led me backwards into my saveUser
method and I've tracked things down to my user object...
In my saveUser I am doing:
<cfset local.user = arguments.event.makeEventBean("credtrak.model.user") />
<cfset beans.usermanager.saveUser(local.user)>
This would fire off and both my preInsert and preUpdate event handlers
would fire - but the preUpdate would always overwrite my
createdby/createdDate values with NULL.
WTF? So I went back and did some dumping and discovered my local.user
object did not have those items set?
userid 21
firstname Test
lastname Testy
emailaddress [email protected]
isactive 1
createddate [empty string] <<< Should be a date
updateddate [empty string]
createdby [empty string] <<< Should be a value
updatedby [empty string]
In contrast if I do (within the same saveUser method)
<cfset jimbo = entityLoadByPK( "User", event.getValue('userid') ) />
I see:
userid 21
firstname Test
lastname Test
emailaddress [email protected]
isactive YES
createddate 2010-10-06 15:49:51.0
updateddate [empty string]
createdby 1
updatedby [empty string]
If I modify my scaffold tag to include the date - then it shows up -
but I don't want to see those fields at any point...
<scaffold object="User" type="edit"
propertylist="firstname,lastname,isactive,emailaddress,createddate"
event-type="templatedPage"/>
userid 21
firstname Test
lastname Test
emailaddress [email protected]
isactive 1
createddate 10/06/2010
updateddate [empty string]
createdby [empty string]
updatedby [empty string]
What am I missing (ie what am I doing wrong) ?? :)
Jim
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en