Hi Alex,
I have created associations as you suggested. Schema is fine now, and going
to check the associations with test data. And yes! started using
annotations instead yaml. Feel comfortable!
You cited that model could be improved, definitely would like to get
suggestions from you.
Thank you very much...really feel relaxed.
Regards,
Swapna V
On Monday, March 31, 2014 2:10:27 AM UTC+5:30, Alexandru Pătrănescu wrote:
>
> To obtain that table structure above entities relations should be
> organized this way:
>
> Role{
> id - integer
> name - string
> }
>
> Users{
> id - integer
> name - string
> role - ManyToOne Role
> relatives - OneToMany Relative
> }
>
> Relations{
> id - integer
> name - string
> }
>
> Relative{
> id - integer
> user - ManyToOne User
> relativeuser ManyToOne User
> relation ManyToOne Relation
> invitedby ManyToOne User
> }
>
> As you see there is no need for a ManyToMany association.
>
> I guess the model could be improved but it is good for start. For now just
> be sure to add 2 Relative objects for a real-life relation, like one
> brother, one brother or one father, one son.
>
>
> I think you should be able to create your yaml file by yourself although I
> suggest to use annotations instead of yaml.
>
> Regards,
> Alex
>
>
>
> On Sun, Mar 30, 2014 at 6:45 PM, Swapna V <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>>
>> I am new to doctrine world. I have problem with understanding
>> many-to-many associations. Following is my table structure:
>>
>> **users**
>>
>> id int(11) NOT NULL
>>
>> name varchar(50) NOT NULL
>>
>> role_id int(11) NOT NULL
>>
>> **roles**
>>
>> int int(11) NOT NULL
>>
>> role varchar(255) NOT NULL
>>
>> **relations**
>>
>> id int(11) NOT NULL
>>
>> name varchar(50) NOT NULL
>>
>> **relatives**
>>
>> id int(11) NOT NULL
>>
>> user_id int(11) NOT NULL
>>
>> relativeuser_id int(11) NOT NULL
>>
>> relation_id int(11) NOT NULL
>>
>> invitedby_id int(11) NULL
>>
>> according to above schema relatives columns user_id, relativeuser_id and
>> invitedby_id are foreign key from users table. And relation_id is foreign
>> key from relations table.
>>
>>
>> Please help me creating associations for this table. (if you give answer
>> in yaml format will be helpful).
>>
>> Thank you,
>>
>> Swapna V
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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/d/optout.