This is more for my own memory, but perhaps it will be useful to others 🙂

Let’s say I have the following entities:

User.cfc

component persistent="true" entityname="User" table="User" {
   property name="UserID" fieldtype="id";
   property name="Name";
   property name="Age";
   property name="Group" 
            fieldtype="many-to-one" 
            cfc="Group" 
            fkcolumn="GroupID";
}

 Group.cfc

component persistent="true" entityname="Group" table="Group" {
   property name="GroupID" fieldtype="id";
   property name="Name";
   property name="Activities" 
            fieldtype="one-to-many" 
            fkcolumn="GroupID" 
            linktable="Activity" 
            inversejoincolumn="ActivityID";
}

Ok, so let’s also imagine that I’m trying to leverage the postDelete() event to make an audit record of any User deletions that I make:

// function postDelete( entity ) {
   // get properties from entity that I want to log
   ... ...
}

When I try to do this, I get something like:

collection >> [Group.Activities] was not processed by flush()

I banged my head on this wall for a while, until I finally figured out the issue.

The issue is the “laziness” of the “Group” property on the User entity. Since I have no value specified, it is equivalent to having specified “lazy=true”.  Since (I assume) the Group property is not being fully “loaded” during the delete operation, there’s no chance that it’s own “Activities” property is loaded either…hence the error.

Anyway, to fix this, I merely added “lazy=false” to my “Group” property. Once in place, I was able to delete AND do my auditing without any errors.