ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 5 replies, has 4 voices, and was last updated by  Geoffroy Cochard 1 year, 2 months ago.

  • Creator
    Topic
  • #8252

    Pavel Levin
    Participant

    Hello!
    I wan`t create OneToOne relationship between entities using migration, but in the ExtendExtension class i found only addOneToManyRelation, addManyToOneRelation and addManyToManyRelation methods. How i can create OneToOne relationship?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #8313

    jakabadambalazs
    Participant

    me neither! Have you found a solution for this yet?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8314

    Pavel Levin
    Participant

    Unfortunately, solutions, except the use of neToMany relationship, I have not found

    #8508

    hugeval
    Participant

    Hi! To create OneToOne relationship using migration, you can use Doctrine native methods Doctrine\DBAL\Schema\Table::addColumn() and Doctrine\DBAL\Schema\Table::addForeignKeyConstraint()

    #8509

    jakabadambalazs
    Participant

    hi @hugeval, thanks but that is not what I am looking for(probably I wasn’t clear enough in my question)
    What I am trying to do is to create a migration extension for my bundle so that other bundles can use it in their migration classes and add the association dynamically – much like you use the noteExtension.

    This means that my migration extension class (implements ExtendExtensionAwareInterface) needs to use the injected Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtension class to add these relationships.

    On ExtendExtension the methods for doing this are: addOneToManyRelation, addManyToOneRelation and addManyToManyRelation, but i am missing addOneToOneRelation.

    ref.: https://github.com/orocrm/platform/tree/master/src/Oro/Bundle/EntityExtendBundle#add-relation


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #20802

    Geoffroy Cochard
    Participant

    Hi,

    As said @hugeval, to create a OneToOne relationship through migrations i’m using this to link orocrm_contact to partner_table by example.
    But when Entity\Extend is generated, methods to manage OneToMany is generated …
    My DB schema is correct (FK Ok, Relation OK)

    In database line config is generated like this :

    And Entity\Extend in cache about “partner” Relation :

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.