#1467: REGRESSION: Problem with many-to-many
------------------------------+---------------------------------------------
Reporter: colnector | Owner: romanb
Type: defect | Status: new
Priority: major | Milestone: 1.0.3
Component: Query/Hydration | Version: 1.0
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
------------------------------+---------------------------------------------
Old description:
> Posted on the forum: http://www.doctrine-
> project.org/forum/posting.php?mode=edit&f=2&p=896
>
> REGRESSION: my queries worked well previously.
> It appears that the wrong fields are selected when a many-to-many field
> is defined. This has happened with two many-to-many relationships I've
> had that specify the same field name in local and foreign. The other
> relationships work well.
>
> Here are the examples:
> [code]abstract class BasePuzzle extends sfDoctrineRecord
> {
> public function setUp()
> {
> $this->hasMany('Picture', array('refClass' => 'ItemPicture',
> 'local' => 'item_id',
> 'foreign' => 'item_id'));
> }
> }
>
> <?php
>
> abstract class BasePicture extends sfDoctrineRecord
> {
> public function setUp()
> {
> $this->hasMany('Puzzle', array('refClass' => 'ItemPicture',
> 'local' => 'item_id',
> 'foreign' => 'item_id'));
> }
> }
>
> [/code]
>
> Now the query including:
> [code] $q = Doctrine_Query::create()
> ->from('Puzzle p')
> ->leftJoin('p.ItemPicture ipic')
> ;[/code]
>
> Would result in the following DQL part:
> LEFT JOIN item_picture i ON [b]p.col[/b] = i.item_id
> instead of
> LEFT JOIN item_picture i ON [b]p.item_id[/b] = i.item_id
New description:
Posted on the forum: http://www.doctrine-
project.org/forum/posting.php?mode=edit&f=2&p=896
REGRESSION: my queries worked well previously.
It appears that the wrong fields are selected when a many-to-many field is
defined. This has happened with two many-to-many relationships I've had
that specify the same field name in local and foreign. The other
relationships work well.
Here are the examples:
{{{
abstract class BasePuzzle extends sfDoctrineRecord
{
public function setUp()
{
$this->hasMany('Picture', array('refClass' => 'ItemPicture',
'local' => 'item_id',
'foreign' => 'item_id'));
}
}
<?php
abstract class BasePicture extends sfDoctrineRecord
{
public function setUp()
{
$this->hasMany('Puzzle', array('refClass' => 'ItemPicture',
'local' => 'item_id',
'foreign' => 'item_id'));
}
}
}}}
Now the query including:
{{{
$q = Doctrine_Query::create()
->from('Puzzle p')
->leftJoin('p.ItemPicture ipic')
;
}}}
Would result in the following DQL part:
LEFT JOIN item_picture i ON '''p.col''' = i.item_id
instead of
LEFT JOIN item_picture i ON '''p.item_id''' = i.item_id
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1467#comment:4>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---