I'm watching this with some interest because (I think) the terminology
seems a bit off.
Generally something that's "injected" lasts the lifetime of the object
it's being injected into... so injecting a transient into a singleton
_seems_ like the wrong way to go about things. I am interested to see
how this works out. If you're actually injecting the transient into
the DAO, that could explain why you're only getting one instance in
your resulting array. CFCs are passed by reference, and when you
inject a bean into an instance of a DAO, you only really have 1 bean,
no matter how many "pointers" you have... you could have an array of
1000 beans all pointing back to the same place in memory that holds
one copy of a bean. Ultimately it means that calling
getHighschoolBean() will only ever touch one physical bean in RAM and
every time you change it, every bean in the array will reflect those
changes.
You need to be creating a copy of the bean on every iteration of the
cfloop, maybe like this:
<cffunction name="read" access="public" returntype="any"
output="false" hint="I return a populated an arrray of highschool
objects">
<cfargument name="ID" type="numeric" required="true" />
<cfset var q = "" />
<cfset var objects = arrayNew(1) />
<cfquery datasource="#getSettings().getDatasource()#" name="q">
<!--- some query --->
</cfquery>
<!--- populate highschool Beans --->
<cfloop query="q">
<cfset objects[q.currentRow] = duplicate(getHighschoolBean()).init(
q.highschoolID, q.graduationDate, q.highschoolGPA,
q.highschoolClassRank, q.highschoolClassSize, q.highschoolPercentile,
q.dateUpdated
) />
</cfloop>
<cfreturn objects />
</cffunction>
Note the addition of the duplicate() function to the line that sets a
bean to objects[q.currentrow]... that'll mean you get a new bean,
instead of the same bean over and over again.
Also, I notice that in your most recent email you say you're calling
addSetterDependency(bean,DAO), but in the sample code in your first
email you are calling
addSetterDependency("educationDAO","hischoolBean"), which is either
backwards or forwards, depending on how the method is actually set up.
If I'm reading the code correctly, your sample code is correct, but
it's worth checking on.
J