Forums OroCRM OroCRM – Programming Questions ManyToMany field added in migration not displayed in UI

This topic contains 3 replies, has 2 voices, and was last updated by  Robin Straub 3 months, 4 weeks ago.

  • Creator
  • #22889

    Robin Straub

    1. Application related information:
    Application Type: OroCRM
    Application Version: 2.4
    Application Edition: Community

    2. Environment related information:
    OS, name and version: OSX 10.12.6
    Web server, name and version: Apache/2.4.25
    Database, name and version: MySQL/5.7.19
    PHP, version: 7.1.8

    3. Issue
    I have to link items to an opportunity. Thus I wrote migrations to :

    • create a custom entity (Vehicle) with some basic fields (id, vin, description and link)
    • add a ManyToMany relation between Opportunity and Vehicle (following this github doc)

    I am doing a reinstall (“php app/console oro:install –drop-database”), I get the following error

    This error happens when the install script runs the command “oro:entity-extend:migration:update-config”.

    I managed to get through this error by disabling the migration for the ManyToMany relation, and executing it in a second time. The relation seems to work as the database is updated accordingly, but the website interface doesn’t show any changes.

    My questions
    How do I fix the migrations not working when executed together?
    How do I enable my ManyToMany relation in the website interface, so I can add vehicles in an opportunity (I managed to do so by adding the relation from the interface “Add Field” tool, but I need to set it in the code so it can be deployed in production without manual configuration).

    Additional informations

    Vehicule migration

    Relation migration

    Vehicule entity

    Please let me know if you need additional informations.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #22891


    Robin, at first, your Vehicle class should extend ExtendVehicle class (created by you previously). Please, read and follow this documentation .

    Do you still have problem after this correction? Please, let me know.


    Robin Straub


    I am still getting the error

    Adding an ExtendVehicle didn’t help fixing the error.

    Here is my ExtendVehicle:

    I also extended my Vehicle entity with ExtendVehicle.

    I don’t know what to do to get rid of this error messages, it prevents me to execute the migrations and see if adding the ExtendVehicle entity fixed my issue.

    Also, do I need to follow the rest of the documentation, explaining how to add the manytomany relation, or doing it with a migration is enough?

    edit: this problem comes from my 2nd migration (see first post for the migration code)


    Robin Straub

    Found the solution.

    The problem was coming from the first migration, I added the fields with param “is_extend”, which caused problems.

    The following migration make the whole thing work, without needing to customize the Opportunity entity:

    The manytomany relation is added with the second migration (see first post) without issues then.

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

You must be logged in to reply to this topic.