Hi

i am new to doctrine and trying to learn from the tutorial here    
doctrine-project 
: 9.1. Association Example 
Entities<http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html>.
 i followed the example of the tutorial and created two classes: Users and 
Comment. (there was a slight problem with the coding of the classes but 
this was resolved in another post; in summary; i had to . 

my two classes are listed here: a gist account:  
<https://gist.github.com/anonymous/8848863>

i am now trying following the second part of the tutorial in which the 
author *Establishing Associations*   . i.e: 
<?php
$user = $em->find(’User’, $userId);
// unidirectional many to many
$comment = $em->find(’Comment’, $readCommentId);
$user->getReadComments()->add($comment);
$em->flush();
// unidirectional many to one
$myFirstComment = new Comment();
$user->setFirstComment($myFirstComment);
$em->persist($myFirstComment);
$em->flush();


my problem however is that when i try to do the above code, i now get this 
message: 

*Fatal error: Call to a member function getReadComments() on a non-object *

i suspect that the problem occurred because there are no values in the 
comments table etc. but i dont know how to put the values into the table. 
i.e it cannot be done manually beucase there is a constraint on the tables. 

i would really appricaite the amendment of the code above to populate all 
the table with intial values. 

sorry to ask this question but i am still trying to get to grips with how 
doctrine works. 

warm regards 

Paul 

-- 
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