On Saturday, March 1, 2014 4:26:13 PM UTC+1, Herman Peeren wrote:
>
> About the second part of your question:
>
> http://www.doctrine-project.org/api/orm/2.4/class-Doctrine.ORM.Query.ResultSetMapping.html#_addFieldResult
> says that the 2nd parameter of addFieldResult( ) = $columnName = The name 
> of the column in the SQL result set 
> and the 3rd parameter = $fieldName = The name of the field on the 
> declaring class. 
> So: the *word_id* in "$rsm->addFieldResult('t', 'translation_id', 
> 'word_id');" is the *field name* of the Words-entity, *not the column 
> name* of the words-table.
> Is that the case or did you happen to name that field something like 
> *$wordId*?
>

Ah, you're right ... of course that should be wordId.
I'm still struggling to get the right output though. I'm not sure how to 
proceed and make it output both the word and the translation. But i guess i 
better put that in a new topic if i don't figure it out.

Still wondering what i'm doing wrong with the ResultSetMappingBuilder 
though, as that seemed a lot easier than manually doing everything.
 

>
> Still puzzling about the first part of your question with the 
> ResultSetMappingBuilder.
>

What exactly is puzzling you? Did i not explain it well enough?
I'd be happy to provide more/better information.

My tables are as follows (in a simplified way):

words
---------
word_id
word
wordtype_id

wordtypes
--------------
wordtype_id
wordtype

word_translations
-------------------------
translation_id
originalword_id
translationword_id

a word has a certain type (verb, noun, etc) and it has translations, which 
are defined by means of the word_translations table (n:n)

With my query (that i put in my first post) i want to select a single word 
with 1 translation.
 

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to