[Coldbox 5.6.2][Quick 3.1.6][Lucee 5.3.6] Resourceful routes mapping to composite parameterName

Resourceful routes in my config/router are usually defined this way:

resources( resource = “profiles”, parameterName = “profileID” );

This works fine in simple instances as above. Now, I need to define a parameter name that is made of two IDs: userLoginID and userProfileID that together, form the primary key of a new entity called userProfile defined as a Quick entity as follows, in addition to other properties I did not include below for the sake of brevity:

variables._key = [“userLoginID”,“userProfileID”];

function keyType() {
return variables._wirebox.getInstance( “NullKeyType@quick” );

My question is: how should I define the parameterName for the new resource userProfiles in the router?

//resources( resource = “userProfiles”, parameterName = “userLoginID, userProfileID” );

//resources( resource = “userProfiles”, parameterName = [“userLoginID”, “userProfileID”] );

//resources( resource = “userProfiles”, parameterName = “userLoginID/userProfileID” );
resources( resource = “userProfiles”, parameterName = “userLoginID.userProfileID” );

//resources( resource = “userProfiles”, parameterName = “userLoginID” , parameterName2 = “userProfileID” );

I have been trying all the above without success. RC never gets both rc.userLoginID and rc.UserProfileID values, always only one. Any suggestion or workaround ?

I don’t believe you can use resources in this case. I would generate the routes by hand so you can craft the url you desire.

You could use addRoute()


pattern = “/users/:userId/documents/:documentId”,
handler = “Document”,
action = {
GET : “show”,
PUT : “update”,
DELETE : “delete” });

Thank you all for the pointer! I updated the router such that the URL is formed as expected (see attached). The RC now gets the two values of the composite key as seen in the attached dump below. However, I now get an error from my Quick entity that tells me that my primary key length is 1 instead of 2, meaning it does not get the two values rc.userLoginID and rc.userProfileID from the handler. I have also attached the handler for the show action that is in error. This is the last issue I need to resolve in order to make Quick work for me for 100% of my legacy schema migration.

Thanks in advance for you help!

Pass the keys in an array to findOrFail.

1 Like

Thank you Eric! Yes it works. Here is how the handler for the show action should look like:

function show(event, rc, prc) {


prc.userProfile = getInstance( “UserProfile” ).findOrFail([rc.userLoginID, rc.userProfileID]);
event.setView( “userProfiles/show”);


Thank you all for the feedback!

1 Like