I have 1:1 mapping between Client and Credit. Credit is the owning side and
Client is parent:
// Credit.php
$metadata->mapOneToOne(array( 'fieldName' => 'credit',
'targetEntity' => 'Entities\\Credit',
'mappedBy' => 'client',
'cascade' => array( 0 => 'remove', 1 => 'persist', ),
'joinColumns' => array( 0 => array( 'name'
=> 'client_id',
'referencedColumnName' => 'client_id',
'nullable' => true,
'onDelete' => 'cascade',
'columnDefinition' => NULL,
), )
));
// Client.php
$metadata->mapOneToOne(array( 'fieldName' => 'client',
'targetEntity' => 'Entities\\Client',
'inversedBy' => 'credit',
'joinColumns' => array( 0 => array( 'name'
=> 'client_id',
'referencedColumnName' => 'client_id',
'nullable' => true,
'columnDefinition' => NULL,
), )
));
But when I try to update schema, it generates the following sql which seems
odd for 1:1 relation:
ALTER TABLE clients ADD CONSTRAINT FK_7996BA0019EB6921 FOREIGN KEY
(client_id) REFERENCES credits (client_id) ON DELETE CASCADE;
ALTER TABLE credits ADD CONSTRAINT FK_3849450A19EB6921 FOREIGN KEY
(client_id) REFERENCES clients (client_id);
It seems that my doctrine confused my 1:1 mapping with inheritance? I have
several other 1:1 relations, I compared this with them and found no
difference and update tool does not suggest sql like above for them. Stuck.
please help.
--
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.