I think you can simply use many to one associations for both user and
review.
Ex : (I simplify annotations)
@Entity
Class User {
@OneToMany(targetEntity="Comment")
private $comments;
}
@Entity
Class Review{
@OneToMany(targetEntity="Comment")
private $comments;
}
@Entity
Class Comment{
@ManyToOne(targetEntity="Review")
private $review;
@ManyToOne(targetEntity="User")
private $user;
}
This way your comments are linked to both reviews and users. From a OOP
design point of view it's simply two aggregations.
Le lundi 21 septembre 2015 19:43:43 UTC+9, ashish saraf a écrit :
>
> I have an application structure say
>
> A user has reviews,
> Reviews have comments
>
> Also comments are made by user indirectly so , user also has comments.
>
> Is this possible that comments can be a child reference to two parents.
>
--
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 https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.