On 4/7/06, Tom McNeer <[EMAIL PROTECTED]> wrote:
> <objects>
> <object name="tblLPWebDocs_Documents" alias="Document" >
> <hasOne name="Category">
> <relate from="document_i_category_id" to="category_i_id" />
> </hasOne>
> </object>
> <object name="tblLPWebDocs_Categories" alias="Category" >
> <hasMany name="Document">
> <relate from="category_i_id" to="document_i_category_id" />
> </hasMany>
> </object>
> </objects>
I suspect the problem is the non-standard name of the primary key? If
it was DocumentID or just ID, I'd expect it to work. Could you try
this code:
<cfset DocumentRecord = Reactor.createRecord("Document") />
<cfset DocumentRecord.load(Document_i_id=1)>
If that works, I suggest you alias your key fields to just "id":
<field name="Document_i_id" alias="id"/>
In fact I'd alias all of your field names since those database column
names are might ugly:
> #DocumentRecord.getDocument_i_id()#<br />
> #DocumentRecord.getDocument_v_title()#<br />
> #DocumentRecord.getDocument_v_description()#<br />
> #DocumentRecord.getDocument_d_changeDate()#<br />
<field name="Document_v_title" alias="title" />
<field name="Document_v_description" alias="description" />
<field name="Document_d_changeDate" alias="changeDate" />
Then your code becomes:
#DocumentRecord.getId()#<br />
#DocumentRecord.getTitle()#<br />
#DocumentRecord.getDescription()#<br />
#DocumentRecord.getChangeDate()#<br />
That's certainly easier to read.
--
Sean A Corfield -- http://corfield.org/
Got frameworks?
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/