hello again Herman

i have made the changes . however, i now have a problem adding data to the 
datase. i.e ( i am still folliwng the tutorial where they start adding 
values to teh table)

public function addComments()
 {    
       $userId=1;
       $readCommentId=1;
        $user = $this->getEntityManager()->find('Products\Entity\Users', 
$userId);
    // unidirectional many to many
    $comment = $this->getEntityManager()->find('Products\Entity\Comment', 
$readCommentId);
          
    $user->getReadComments()->add($comment);
    $this->getEntityManager()->flush();
    
 } 

i now get this error message: 

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

i think that the problem is caused because the tables are empty; however i 
am prevented from entering teh values into teh tables becuase of 
constraints. 

any advise on how you entered values intot eh table. 
    





On Thursday, February 6, 2014 12:07:11 PM UTC, Herman Peeren wrote:
>
> Just gave my solution to the problem in the "error in my code when i 
> followed the doctrine 2 tutorial at 9.1. Association Example Entities" 
> thread, but the message was deleted. Tried twice, but same result. Why did 
> that happen??? 
>
> Here, once again, I'll say what I posted (bit abbreviated and without any 
> maybe wrong characters like the at-sign):
> I think the example is wrong: there are 2 many-to-may associations between 
> the users and comments. Both use another join-table. I think the 
> join-tablesuser_favorite_commentsand
> user_read_comments must be specified. 
>

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