ssossossosso

Forums

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

This topic contains 3 replies, has 2 voices, and was last updated by Mike Kudelya Mike Kudelya 10 months, 1 week ago.

  • Creator
    Topic
  • #24222

    franconob
    Participant

    Hello guys, I’m trying to add an inverse relation to a many to one relation. This is my custom class:

    This is my migration script:

    The addManyToOne relation method works fine. But when the migration command executes the addManyToOneInverseRelation, I get the following error:

    [Doctrine\ORM\Mapping\MappingException]
    The association mapping ‘balances’ misses the ‘targetEntity’ attribute.

    What am I doing wrong? Is this a bug? I just want this inverse relation to use the “balances” association field in a query builder.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #24253
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    I have created similar migration:

    and it successfully executed, but if i remove addManyToOneRelation call, script fails with our error.
    Did you try execute our migration twice? Try to run this migration on brand new database. When you want to have relations between your Balance and other entities please set your entity as extended. Just create ExtendBalance class in /Model folder and extend Balance from ExtendBalance. You can look at User entity, how it made there.

    #24257

    franconob
    Participant

    Hello Mike, thanks for your help. I’m currently in a new database. I’m also using orocommerce 1.0.0-beta.3, not OroCRM, could it be a problem? I’ve not created an extended entity, maybe that’s the real problem. I’m going to try that and I’ll let you know.

    Thanks!

    #24265
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi

    Also is not necessary to add $account property with getters and setters on Balance entity. They will be automatically created in your Balance Extended class, try to search it in app/cache/[dev or prod]/oro_entities/Extend/Entity directory.

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

You must be logged in to reply to this topic.