Hello,
I have very recently begun to play with Reactor and I've found what looks to
be an old bug. Basically, I have two tables: Events and EventCategories
that are joined in a many-to-many relationship via a linking table
(EventsEventCategories). When I set this all up in Reactor, I'm getting an
error:
---
An error occured while Transforming an XML document.
Empty expression!
The error occurred in C:\data\code\frameworks\cfm
\reactor\reactor\reactor\core\objectTranslator.cfc: line 144
Called from C:\data\code\frameworks\cfm
\reactor\reactor\reactor\core\objectTranslator.cfc:
line 159
Called from
C:\data\code\frameworks\cfm\reactor\reactor\reactor\core\objectTranslator.cfc:
line 159
Called from C:\data\code\frameworks\cfm
\reactor\reactor\reactor\core\objectTranslator.cfc:
line 99
Called from C:\data\code\frameworks\cfm
\reactor\reactor\reactor\core\objectFactory.cfc:
line 223
Called from
C:\data\code\frameworks\cfm\reactor\reactor\reactor\reactorFactory.cfc:
line 80
Called from C:\data\code\frameworks\cfm
\modelglue\modelglue\ModelGlue\unity\orm\ReactorAdapter.cfc:
line 246
Called from C:\data\code\frameworks\cfm
\modelglue\modelglue\ModelGlue\unity\orm\ReactorAdapter.cfc:
line 201
Called from
C:\data\code\frameworks\cfm\modelglue\modelglue\ModelGlue\unity\eventhandler\EventHandle
rFactory.cfc: line 28
Called from C:\data\code\frameworks\cfm \modelglue\modelglue\ModelGlue
\unity\loader\XmlConfigurationLoader.cfc : line 367
Called from C:\data\code\frameworks\cfm \modelglue\modelglue\ModelGlue
\unity\loader\XmlConfigurationLoader.cfc : line 61
Called from C:\data\code\frameworks\cfm \modelglue\modelglue\ModelGlue
\unity\loader\FrameworkLoader.cfc: line 73
Called from C:\data\code\frameworks\cfm
\modelglue\modelglue\ModelGlue\unity\ModelGlue.cfm:
line 108
Called from C:\data\projects\ask\empower\code\branches\modelglue\index .cfm:
line 50
142 : <!--- search to see if path exists in the document --->
143 : <!---<cftry>--->
144 : <cfset matches = XmlSearch( arguments.xml, arguments.pathToNode) />
145 : <!---<cfcatch>
146 : <cfdump var="#matches#" />
---
Here is a pared down version of the tables:
---
CREATE TABLE dbo.Events (
event_id int NOT NULL PRIMARY KEY,
title varchar(50) NULL
)
CREATE TABLE dbo.EventCategories (
event_category_id int NOT NULL PRIMARY KEY,
parent_event_category_id int NULL,
name varchar(50) NULL
)
CREATE TABLE dbo.EventsEventCategories (
event_event_category_id int NOT NULL PRIMARY KEY,
event_id int NOT NULL,
event_category_id int NOT NULL
)
---
And here is my Reactor.xml, with the offending line highlighted:
---
<reactor>
<objects>
<object name="Events" alias="Event">
<hasMany name="EventCategory">
<link name="EventEventCategory" from="Event"
to="EventCategory" />
</hasMany>
</object>
<object name="EventCategories" alias="EventCategory">
<hasOne name="EventCategory" alias="ParentEventCategory">
<relate from="parent_event_category_id"
to="event_category_id" />
</hasOne>
<hasMany name="Event">
<link name="EventEventCategory" from="EventCategory"
to="Event" />
</hasMany>
</object>
<object name="EventsEventCategories" alias="EventEventCategory">
<hasOne name="Event">
<relate from="event_id" to="event_id" />
</hasOne>
<hasOne name="EventCategory">
<relate from="event_category_id" to="event_category_id" />
</hasOne>
</object>
</objects>
</reactor>
---
If I remove the line highlighted above, I don't get the error, but that
obviously isn't the solution.
After some searches, I found that this (or a similar problem) was fixed in
r331 <http://trac.reactorframework.com/reactor/changeset/331>, but reverted
in r344 <http://trac.reactorframework.com/reactor/changeset/344#file2>. If
I reapply these changes to
objectTranslator.cfc<http://trac.reactorframework.com/reactor/browser/trunk/reactor/core/objectTranslator.cfc>,
my problem goes away. Was this an accident? Am I missing something?
Incidentally, I am running all this via Model-Glue Unity's scaffolding.
Thanks,
Justin
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --