On 12 June 2015 at 18:41, Marco Pivetta <[email protected]> wrote

>
> I think it's actually a mapping issue. Are you re-using the same owning
> field for multiple associations?
>

Its the already existing tests
Doctrine\Tests\ORM\Functional\ValueConversionType\OneToOneCompositeIdTest.php
Doctrine\Tests\ORM\Functional\ValueConversionType\OneToOneCompositeIdForeignKeyTest.php

These extend class OrmFunctionalTestCase which defines the model sets being
used
        'vct_onetoone_compositeid' => array(

'Doctrine\Tests\Models\ValueConversionType\InversedOneToOneCompositeIdEntity',

'Doctrine\Tests\Models\ValueConversionType\OwningOneToOneCompositeIdEntity'
        ),
and
        'vct_onetoone_compositeid_foreignkey' => array(
            'Doctrine\Tests\Models\ValueConversionType\AuxiliaryEntity',

'Doctrine\Tests\Models\ValueConversionType\InversedOneToOneCompositeIdForeignKeyEntity',

'Doctrine\Tests\Models\ValueConversionType\OwningOneToOneCompositeIdForeignKeyEntity'
        ),

And the model files:

class InversedOneToOneCompositeIdEntity
    /**
     * @OneToOne(targetEntity="OwningOneToOneCompositeIdEntity",
mappedBy="associatedEntity")
     */
    public $associatedEntity;

vs

class InversedOneToOneCompositeIdForeignKeyEntity
    /**
     * @OneToOne(targetEntity="OwningOneToOneCompositeIdForeignKeyEntity",
mappedBy="associatedEntity")
     */
    public $associatedEntity;

And

class OwningOneToOneCompositeIdEntity
    /**
     * @OneToOne(targetEntity="InversedOneToOneCompositeIdEntity",
inversedBy="associatedEntity")
     * @JoinColumns({
     *     @JoinColumn(name="associated_id1", referencedColumnName="id1"),
     *     @JoinColumn(name="associated_id2", referencedColumnName="id2")
     * })
     */
    public $associatedEntity;

vs

class OwningOneToOneCompositeIdForeignKeyEntity
    /**
     *
@OneToOne(targetEntity="InversedOneToOneCompositeIdForeignKeyEntity",
inversedBy="associatedEntity")
     * @JoinColumns({
     *     @JoinColumn(name="associated_id", referencedColumnName="id1"),
     *     @JoinColumn(name="associated_foreign_id",
referencedColumnName="foreign_id")
     * })
     */
    public $associatedEntity;

As you can see these two independent cases use the same name for mapping
the OneToOne-ness between their pairs via the field "$associatedEntity".
That doesn't feel like a mapping issue. I should be able to use the same
name to link A-B and C-D.

-- 
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.

Reply via email to