Ticket #84 (new defect)

Opened 2 years ago

Last modified 1 month ago

External object fields break query.returnObjectField/s

Reported by: cblackwell Owned by: dhughes
Type: defect Priority: high
Milestone: 1.0 Release Component: Reactor - Gateway
Version: Severity: critical
Keywords: spam Cc:

Description

I've been trying to get an OO query to return a two columns, with only
distinct values, but for some reason it was ignoring the
returnObjectField, and returning every column.

Heres my code.

<object name="ProductOption">
	<field source="Option" field="Name" />
	<hasOne name="Option">
		<relate from="OptionId" to="OptionId" />
	</hasOne>
</object>

<cfset pog = rf.createGateway("ProductOption")>
<cfset q = pog.createQuery()>
<cfset q.getWhere().isEqual("ProductOption", "ProductId", 1)>
<cfset q.getOrder().setAsc("ProductOption", "OptionId")>
<cfset q.returnObjectField("ProductOption", "OptionId")>
<cfset q.setDistinct(true)>

<cfdump var="#pog.getByQuery(q)#">

After much head scratching I removed the external field from the
ProductOption object and blew away my project files and it now works.

Also, joining the tables "manually" does work and I get only my desired
columns

<cfset q.join("ProductOption", "Option", "Option")>
<cfset q.returnObjectField("Option", "Name")>

Change History

Changed 2 years ago by kylehayes

I am having to initiate objects differently by typing the following:
reactorFactory.createRecord('myTable').init().load(id=5)

BROKEN (returns ambiguous record when only one exists):
reactorFactory.createRecord('myTable').init(id=5).load()

Changed 2 years ago by kylehayes

It seems the following code inside the DAO is not being generated correctly:

<cfif Len(arguments.loadFieldList)>
   <cfset employeeQuery = employeeGateway.createQuery() />
   <cfloop list="#arguments.loadFieldList#" index="field">
      <cfset employeeQuery.getWhere().isEqual("employee", field, arguments.to[field]) />
   </cfloop>
			
   <cfset qRead = employeeGateway.getByQuery(employeeQuery,true) />
<cfelse>
   <cfset qRead = employeeGateway.getByFields(
				
			) />
</cfif>

The PK values are not being inputted into the getByFields area.

Changed 1 month ago by mark.drew@…

  • milestone set to 1.0 Release

Changed 1 month ago by TomChiverton

  • keywords spam added
Note: See TracTickets for help on using tickets.