I’m trying to update qb and cfcollection to the la...
# box-products
d
I’m trying to update qb and cfcollection to the latest versions within an app. (like qb v3.x to 8.x 😬) We have a
returnType
specified in our qb ColdBox.cfc to return a collection, but it just keeps returning an array of structs. So later on down the road the pluck method is failing when the results from qb are used. Am I missing something? Config and stuff in the thread.
Here is the qb config within Coldbox.cfc…
Copy code
'qb'     : {
				'defaultGrammar' : 'OracleGrammar@qb',
				"returnFormat": function( q ) {
					return application.wirebox.getInstance(
						"name" = "Collection",
						"initArguments" = { "collection": q }
					);
				}
			},
And the DAO is doing a
wirebox.getInstance( 'QueryBuilder@qb' )
and then eventually a
.get()
. Any ideas why it is coming back as an array of structs instead of a collection?
Within the qb builder, throwing the return format there worked…
Copy code
.setReturnFormat( function( q ) {
				return application.wirebox.getInstance(
					"name" = "Collection",
					"initArguments" = { "collection": q }
				);
			} )
e
Do you have quick and qb? If so, quick forces a return format of array. You then use the
newCollection
method on the entity to return your custom collection.
d
Good question. There is not quick in this app, just qb. I had to add that
setReturnFormat
to every QueryBuilder that returns something. Hmm.
e
That would need some more digging. That should be working. I'd check what is configured when getting a new instance and debug from there.
d
For sure. Thanks for the info.