Ok, let me try to clarify:
Let's assume the call to beans.MenuService.list() returns "1,2,3", the
eventKey "allMenus" has a value of "123".
Further, assuming the call to beans.MenuService.getMenusWithSameParent()
returns "4,5,6", the eventKey "allSameLevelMenus" has a value of "4,5,6".
So if I do this in my controller:
<cffunction name="get">
<cfargument name="event" type="any" required="true">
[...] <cfset
arguments.event.setValue("allMenus",beans.MenuService.list(local.domainId))>
<cfset
arguments.event.setValue("allSameLevelMenus",beans.MenuService.getMenusWithSameParent(domainId=local.domainId,
parentMenu = local.menuBean.getParentMenu()))>
<cfdump var="#arguments.event.getValue('allMenus')#">
<cfdump var="#arguments.event.getValue('allSameLevelMenus')#">
[...]
I expect to see this in my browser:
1,2,3
4,5,6
(forget the extra line
<cfset
arguments.event.setValue("languages",beans.ApplicationConfiguration.getConfigSetting("languages"))>
in my previous post)
But instead I see this:
4,5,6
4,5,6
This is menuGateway.cfc where the values are actually retrieved and
returned:
<cffunction name="init">
<cfargument name="MenuBean" type="Application.Beans.MenuBean">
<cfset Variables.Bean=arguments.MenuBean>
<cfreturn THIS>
</cffunction>
<cffunction name="getMenusWithSameParent" hint="get all menus with the
same parentMenu as the specified menu">
[...]
<cfreturn
Variables.Bean.populateBeanCollection(local.Transfer.listByQuery(local.TQuery))>
</cffunction>
and
<cffunction name="list" returntype="Application.Beans.MenuBean" hint="">
[...]
<cfreturn
Variables.Bean.populateBeanCollection(local.Transfer.listByQuery(local.query))>
</cffunction>
Both methods are return the same object: first list() and then
getMenusWithSameParent().
It looks like list() populates the Variables.Bean with 1,2,3 and
getMenusWithSameParent() populates the _same instance_ of that bean with
4,5,6 so in the end both eventkeys "allMenus" and "allSameLevelMenus" point
to the same instance of Variables.Bean.
I solved this by changing
<cffunction name="list" returntype="Application.Beans.MenuBean" hint="">
[...]
<cfreturn
Variables.Bean.populateBeanCollection(local.Transfer.listByQuery(local.query))>
</cffunction>
to
<cffunction name="list" returntype="Application.Beans.MenuBean" hint="">
[...]
<cfreturn
Duplicate(Variables.Bean.populateBeanCollection(local.Transfer.listByQuery(local.query)))>
</cffunction>
so Duplicate() makes sure _another_ instance of Variables.Bean is returned
instead of the same instance.
But this is clumsy - I cannot use Duplicate() on an ad-hoc basis.
I hope I made my question clear. If not, just ask ask again.
Marc
--
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