Doctrine core developer here.
Doctrine staff do care about bug reports, but we work on our free time on
Doctrine and we're not paid to do it, specially fix bugs on people's
mapping. I see many times you comment about we being omissive to your "bug
reports", while your pure and only mistake is not RTFM.
That said, your mapping is wrong. you cannot have on table A a field named
a_id that is both a FK to table B and a FK to table C. No such DB supports
that and it's not Doctrine's fault. You mention on a previous email you use
object A property ID as the central identifier, but in your mapping it's
not.
I do suspect you want to keep the access bidirectionally between A->B, B->A
and A->C, C->A. That said, you cannot map both associations B and C over
the column a_id. You need separate fields for that. Killing the
bidirectionality would allow you to remove the required columns b_id and
c_id for your mapping to work.
Here is your FIXED mapping.
Entity A:
$metadata->mapOneToOne(array(
'fieldName' => 'B',
'targetEntity' => 'Entity\\B',
'mappedBy' => 'A',
'cascade' => array(
0 => 'remove',
1 => 'persist',
),
'joinColumns' => array(
0 => array(
'name' => 'b_id',
'referencedColumnName' => 'a_id',
'nullable' => true,
'onDelete' => 'cascade',
'columnDefinition' => NULL,
),
),
));
$metadata->mapOneToOne(array(
'fieldName' => 'C',
'targetEntity' => 'Entity\\C',
'mappedBy' => 'A',
'cascade' => array(
0 => 'remove',
1 => 'persist',
),
'joinColumns' => array(
0 => array(
'name' => 'c_id',
'referencedColumnName' => 'a_id',
'nullable' => true,
'onDelete' => 'cascade',
'columnDefinition' => NULL,
),
),
));
Entity B:
$metadata->mapOneToOne(array(
'fieldName' => 'A',
'targetEntity' => 'Entity\\A',
'inversedBy' => 'B',
'joinColumns' => array(
0 => array(
'name' => 'a_id',
'referencedColumnName' => 'b_id',
'nullable' => true,
'columnDefinition' => NULL,
),
),
));
Entity C:
$metadata->mapOneToOne(array(
'fieldName' => 'A',
'targetEntity' => 'Entity\\A',
'inversedBy' => 'C',
'joinColumns' => array(
0 => array(
'name' => 'a_id',
'referencedColumnName' => 'c_id',
'nullable' => true,
'columnDefinition' => NULL,
),
),
));
PS: Read The Fine Manual.
Thanks,
On Tue, Jul 7, 2015 at 4:20 PM, Nima Sadjadi <[email protected]> wrote:
> If doctrine staff don't care for bug reports and wait for others to create
> test case for them, doctrine will die soon anyway...
>
> --
> 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.
>
--
Guilherme Blanco
MSN: [email protected]
GTalk: guilhermeblanco
Toronto - ON/Canada
--
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.