Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid call of qualifyColumn on hasManyDeep with compound keys (from 7.3.1 --> 11) #260

Closed
MordantWastrel opened this issue Feb 4, 2025 · 2 comments

Comments

@MordantWastrel
Copy link
Contributor

Upon invoking a hasManyThrough that worked in 7.3.1:

Entity 1 qCompetitionSeasonDivision.cfc (stripped down):

component table="competition_seasonal_divisional" extends="model.q.inLeagueBaseEntity" accessors=true {

	/* properties */

	property name="compSeasonDivUID" column="compSeasonDivUID" type="string" sqltype="idstamp";
	property name="competitionUID"   column="competitionUID"   type="string" sqltype="idstamp";
	property name="seasonUID"        column="seasonUID"        type="string" sqltype="idstamp";
	property name="divID"            column="divID"            type="string" sqltype="idstamp";

	/* === PRIMARY KEY === */
	function keyType() {
		return _wirebox.getInstance( "ReturningKeyType@quick" );
	}

	variables._key = "compSeasonDivUID";

	function v_compSeasonDiv_forAllSourceCompsIncludingSelfSource() {
		return hasMany(
			relationName = "q_v_compSeasonDiv_forAllSourceCompsIncludingSelfSource",
			foreignKey = "compSeasonDivUID",
			localKey = "compSeasonDivUID"
		);
	}

	function competitionRegistrationsIncludingSourcedCompetitions() {
		return hasManyThrough(
			relationships = [ "v_compSeasonDiv_forAllSourceCompsIncludingSelfSource", "competitionRegistrations" ]
		)
	}

Intermediate Entity q_v_compSeasonDiv_forAllSourceCompsIncludingSelfSource.cfc:

component extends="model.q.inLeagueBaseEntity" table="v_competition_seasonal_divisional_forAllSourceCompsIncludingSelfSource" accessors=true {

	property name="compSeasonDivUID"     type="guid"    sqltype="idstamp" readonly=true update=false;
	property name="competitionUID"       type="guid"    sqltype="idstamp" readonly=true update=false;
    property name="seasonUID"            type="guid"    sqltype="idstamp" readonly=true update=false;
	property name="divID"                type="guid"    sqltype="idstamp" readonly=true update=false;
	property name="sourceCompetitionUID" type="guid"    sqltype="idstamp" readonly=true update=false;

	variables._key = 'compSeasonDivUID'

    function competitionRegistrations() {
        return hasMany(
            relationName = "qCompetitionRegistration",
            foreignKey = ["competitionUID", "seasonUID", "divID"],
            localKey = ["sourceCompetitionUID", "seasonUID", "divID"]
        )
    }

	function compSeasonDiv() {
		return belongsTo(
			relationName = "qCompetitionSeasonDivision",
			foreignKey = ["competitionUID", "seasonUID", "divID"],
            localKey = ["sourceCompetitionUID", "seasonUID", "divID"]
		)
	}
}

Target entity qCompetitionRegistration.cfc

component table="competition_registrations" extends="model.q.inLeagueBaseEntity" accessors=true {

	/* properties */

	property name="competitionRegistrationID" type="numeric" sqltype="integer";
	property name="childID"                   type="string"  sqltype="idstamp";
	property name="seasonUID"                 type="string"  sqltype="idstamp";
	property name="competitionUID"            type="string"  sqltype="idstamp";
	property name="divID" type="string" sqltype="idstamp";


	/* === PRIMARY KEY === */
	variables._key = "competitionRegistrationID";

	function competitionSeasonDivision() {
		return belongsTo(
			relationName = 'qCompetitionSeasonDivision',
			localKey = [ "competitionUID", "seasonUID", "divID" ],
			foreignKey = [ "competitionUID", "seasonUID", "divID" ]
		)
	}
lucee.runtime.exp.UDFCasterException: Invalid call of the function [qualifyColumn], first Argument [column] is of invalid type, Cannot cast Object type [Array] to a value of type [string]
	at lucee.runtime.type.UDFImpl.castToAndClone(UDFImpl.java:120)
	at lucee.runtime.type.UDFImpl.defineArguments(UDFImpl.java:136)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:355)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
	at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.relationships.hasmanydeep_cfc$cf.udfCall2(/quick/models/Relationships/HasManyDeep.cfc:250)
	at models.relationships.hasmanydeep_cfc$cf.udfCall(/quick/models/Relationships/HasManyDeep.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.relationships.baserelationship_cfc$cf.udfCall3(/quick/models/Relationships/BaseRelationship.cfc:442)
	at models.relationships.baserelationship_cfc$cf.udfCall(/quick/models/Relationships/BaseRelationship.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.relationships.hasmanydeep_cfc$cf.udfCall1(/quick/models/Relationships/HasManyDeep.cfc:202)
	at models.relationships.hasmanydeep_cfc$cf.udfCall(/quick/models/Relationships/HasManyDeep.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.type.EnvUDF.call(EnvUDF.java:97)
	at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at modules.quick.models.quickqb_cfc$cf.udfCall5(/modules/quick/models/QuickQB.cfc:990)
	at modules.quick.models.quickqb_cfc$cf.udfCall(/modules/quick/models/QuickQB.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.query.querybuilder_cfc$cf.udfCall9(/qb/models/Query/QueryBuilder.cfc:1661)
	at models.query.querybuilder_cfc$cf.udfCall(/qb/models/Query/QueryBuilder.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:699)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
	at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1952)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:900)
	at lucee.runtime.functions.dynamicEvaluation.Invoke.call(Invoke.java:49)
	at models.quickbuilder_cfc$cf.udfCall6(/quick/models/QuickBuilder.cfc:775)
	at models.quickbuilder_cfc$cf.udfCall(/quick/models/QuickBuilder.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
	at lucee.runtime.ComponentImpl.onMissingMethod(ComponentImpl.java:625)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:588)
	at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.relationships.hasmanydeep_cfc$cf.udfCall1(/quick/models/Relationships/HasManyDeep.cfc:209)
	at models.relationships.hasmanydeep_cfc$cf.udfCall(/quick/models/Relationships/HasManyDeep.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
	at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.quickbuilder_cfc$cf.udfCall2(/quick/models/QuickBuilder.cfc:265)
	at models.quickbuilder_cfc$cf.udfCall(/quick/models/QuickBuilder.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.type.EnvUDF.call(EnvUDF.java:97)
	at lucee.runtime.type.scope.ArgumentImpl.call(ArgumentImpl.java:519)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.baseentity_cfc$cf.udfCall7(/quick/models/BaseEntity.cfc:1291)
	at models.baseentity_cfc$cf.udfCall(/quick/models/BaseEntity.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
	at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.quickbuilder_cfc$cf.udfCall2(/quick/models/QuickBuilder.cfc:270)
	at models.quickbuilder_cfc$cf.udfCall(/quick/models/QuickBuilder.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.type.EnvUDF.call(EnvUDF.java:97)
	at lucee.runtime.type.scope.ArgumentImpl.call(ArgumentImpl.java:519)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.baseentity_cfc$cf.udfCallh(/quick/models/BaseEntity.cfc:3079)
	at models.baseentity_cfc$cf.udfCall(/quick/models/BaseEntity.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
	at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at models.quickbuilder_cfc$cf.udfCall2(/quick/models/QuickBuilder.cfc:271)
	at models.quickbuilder_cfc$cf.udfCall(/quick/models/QuickBuilder.cfc)
	at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
	at lucee.runtime.type.UDFImpl._call(UDFImpl.java:358)
	at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:698)
	at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
	at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
	at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
	at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1776)
	at q.competition.qcompetitionseasondivision_cfc$cf.udfCall3(/model/q/Competition/qCompetitionSeasonDivision.cfc:155)
	at q.competition.qcompetitionseasondivision_cfc$cf.udfCall(/model/q/Competition/qCompetitionSeasonDivision.cfc)
@elpete
Copy link
Collaborator

elpete commented Feb 5, 2025

Fixed in 11.1.0

@MordantWastrel
Copy link
Contributor Author

@elpete This is fixed but the same entities throw a new error when using withCount() which I've described here:

#262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants