Thank you,Alan.
Himasnhu

In case of M:M relation, columns "local" and "foreign" refers to columns on 
"refClass".


2010/12/31 himanshu <hisupa...@yahoo.com>

Hi Alan,
>Your solution works!
>I thank you for your help. This kind of cooperation helps to grow a novice 
>developers like me.
> 
>I would appreciate if you can help me to understand following/or give some 
>reference link to read.
> 
>Your solution has created following class properties in setup() method of base 
>class.
>       Tax
>    public function setUp()
>    {
>        parent::setUp();
>        $this->hasMany('Property as Properties', array(
>             'refClass' => 'PropertyTax',
>             'local' => 'tax_id',
>             'foreign' => 'property_id'));
>        $this->hasMany('PropertyTax', array(
>             'local' => 'id',
>             'foreign' => 'tax_id'));
>    }
>
>Property:
>        $this->hasMany('PropertyTax', array(
>             'local' => 'id',
>             'foreign' => 'property_id'));
>        $this->hasMany('Tax as Taxes', array(
>             'refClass' => 'PropertyTax',
>             'local' => 'property_id',
>             'foreign' => 'tax_id'));
>
>PropertyTax:
>        $this->hasOne('Tax', array(
>             'local' => 'tax_id',
>             'foreign' => 'id',
>             'onDelete' => 'CASCADE'));
>        $this->hasOne('Property', array(
>             'local' => 'property_id',
>             'foreign' => 'id',
>             'onDelete' => 'CASCADE'));
> 
>If you see above underlined code, you will get my question. 
>Tax and Proeprty table do not have 'tax_id' and 'property_id' fields. Still it 
>refers thise columns in local field  value. I dont understand it. Would you 
>please  explain?
> 
>Thanking you again.
> 
>Himanshu
>
>
>
________________________________
 From: Alan Bem <alan....@gmail.com>
>To: symfony-users@googlegroups.com
>Sent: Fri, 31 December, 2010 4:31:34 PM
>Subject: Re: [symfony-users] doctrine many-to-many relation
>
>
>Tax:
>  actAs:
>    Timestampable: ~
>  columns:
>    # your columns
>  relations:
>    Properties:
>      class:        Property
>      local:        tax_id
>      foreign:      property_id
>      refClass:     PropertyTax
>      foreignAlias: Taxes
>
>Property:
>  actAs:
>    Timestampable: ~
>  columns:
>    # your columns
>
>PropertyTax:
>  actAs:
>    Timestampable: ~
>  columns:
>    property_id:
>      type:     integer
>      primary: true
>    tax_id:
>      type:    integer
>      primary: true
>  relations:
>    Tax:
>      local:    tax_id
>      onDelete: CASCADE
>    Property:
>      local:    property_id
>      onDelete: CASCADE
>
>-- 
>If you want to report a vulnerability issue on symfony, please send it to 
>security at symfony-project.com
> 
>You received this message because you are subscribed to the Google
>Groups "symfony users" group.
>To post to this group, send email to symfony-users@googlegroups.com
>To unsubscribe from this group, send email to
>symfony-users+unsubscr...@googlegroups.com
>For more options, visit this group at
>http://groups.google.com/group/symfony-users?hl=en
>
>
>
-- 
>If you want to report a vulnerability issue on symfony, please send it to 
>security at symfony-project.com
> 
>You received this message because you are subscribed to the Google
>Groups "symfony users" group.
>To post to this group, send email to symfony-users@googlegroups.com
>To unsubscribe from this group, send email to
>symfony-users+unsubscr...@googlegroups.com
>For more options, visit this group at
>http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com
 
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to