This was a little strange. I'm calling a setUpdatedAt(now()) in my TO 
from the actionBeforeUpdateTransferEvent method in an observer. 
Everything works great and the database is updated correctly. The 
problem comes when trying to access the property just after save. It 
still has the old value in it.

In AuditObserver.cfc in actionBeforeUpdateTransferEvent():

      <cfif structKeyExists( to, "setUpdatedAt" )>   
            <cfset to.setUpdatedAt( now() ) />
        <cfelseif structKeyExists( to, "setUpdatedOn" )>   
            <cfset to.setUpdatedOn( now() ) />
      </cfif>


In my save page, here are a couple scenarios:
   
    <!--- This one shows the previous updated date (prior to the 
observer update) even though the correct date is saved in the db --->
    <cfif accountService.save( account )>     
        <cfdump var="#account.getUpdatedAt()#">
       ...
    </cfif>

another...

    <cfif accountService.save( account )>
       <!--- If I force a reload, I then get the correct date --->
        <cfdump 
var="#accountService.get(account.getID()).getUpdatedAt()#">      
       ...
    </cfif>

and lastly...

    <!--- If I manually set the date prior to save --->
    <cfset account.setUpdateAt("2000-01-01") />

    <!--- The save is observed and the updatedAt property is set and 
correctly persisted to the db --->
    <cfif accountService.save( account )>
       <!--- But this still outputs 2000-01-01 rather than the correct 
date in the db --->
        <cfdump var="#account.getUpdatedAt()#">
       ...
    </cfif>

Even though the data in the object does not reflect the db values right 
after a save, the object is not dirty and it is persisted. So something 
is off. Again this only happens when values are updated from an 
observer. Let me know if I need to clarify anything. Thoughts?

Running Transfer 1.1 on Win XP, CF8, Java 1.6_10.

-Ryan


--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" 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/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to