selectManyToManyData() with recordCountOnly=true throws an error

Doing this works and returns a query:

         var pur = userDao.selectManyToManyData(
            propertyName = "hasAbo"
          ,filter = { "id" = getLoggedInUserId(), "hasAbo.id"=event.getSite().objekt}  
        )

But

        var pur = userDao.selectManyToManyData(
            propertyName = "hasAbo"
           ,filter = { "id" = getLoggedInUserId(), "hasAbo.id"=event.getSite().objekt}  
           ,recordCountOnly = true
        )

returns a:

The function [selectManyToManyData] has an invalid return value , [Cannot cast Object type [Number] to a value of type [query]]

Detail:

the function is located at [C:\commandbox\naturmedizin\preside\system\services\presideObjects\PresideObjectService.cfc]

Stack

lucee.runtime.exp.UDFCasterException: The function [selectManyToManyData] has an invalid return value , [Cannot cast Object type [Number] to a value of type [query]] at lucee.runtime.type.UDFImpl._call(UDFImpl.java:366) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:685) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1930) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766) at system.services.presideobjects.presideobjectdecorator_cfc$cf.udfCall(/preside/system/services/presideObjects/PresideObjectDecorator.cfc:53) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:684) at lucee.runtime.ComponentImpl.onMissingMethod(ComponentImpl.java:611) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:574) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1930) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766) at extensions.preside_ext_advertising_manager1980.handlers.advertising_cfc$cf$f5.udfCall(/app/extensions/preside-ext-advertising-manager/handlers/advertising.cfc:75) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217) at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:785) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747) at extensions.preside_ext_advertising_manager1980.handlers.advertising_cfc$cf$f5.udfCall(/app/extensions/preside-ext-advertising-manager/handlers/advertising.cfc:8) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:802) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766) at system.eventhandler_cfc$cf.udfCall(/coldbox/system/EventHandler.cfc:89) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:685) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1930) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766) at system.coldboxmodifications.controller_cfc$cf.udfCall2(/preside/system/coldboxModifications/Controller.cfc:227) at system.coldboxmodifications.controller_cfc$cf.udfCall(/preside/system/coldboxModifications/Controller.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:802) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766) at system.web.controller_cfc$cf.udfCall3(/coldbox/system/web/Controller.cfc:831) at system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207) at

Raised as bug: [PRESIDECMS-2685] - JIRA

Good spot.

Fix is done and will come in the next hotfix. Basically, the method delegates to the main selectData() method, so should have the same return type (any).

1 Like

Latest hotfixes include gthe fix for this…