ssossossosso

Forums

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

This topic contains 8 replies, has 2 voices, and was last updated by  leahaense 2 years, 9 months ago.

  • Creator
    Topic
  • #4028

    leahaense
    Participant

    I’d like to add a custom entity with a new table in the database. I created the entity and then tried to run app/console doctrine:schema:update –dump-sql, but I got an exception:

    [Doctrine\DBAL\Schema\SchemaException]
    The table with name ‘oro_crm.oro_access_group’ already exists.

    How can I update my schema? I saw that there’s a MigrationBundle but I didn’t really understand if I can use that somehow and if yes, how. Thanks for the help.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #4039

    Vova Soroka
    Oro Core

    It seems your entity has @ORM\Table(name=”oro_access_group”) annotation which is already used by Oro\Bundle\UserBundle\Entity\Group.

    The doctrine:schema:update works fine during development process, but to apply database changes on production you should create a migration. The easiest way to get the migration code is to run oro:migration:dump command and then find changes related to your entities in the output of this command and copy them in the migration.

    #4040

    leahaense
    Participant

    It does not. But when I search for ‘oro_access_group’ in all Oro classes I find two classes having that in the @Table annotation:

    – Oro\Bundle\DistributionBundle\Entity\Security\Group
    – Oro\Bundle\UserBundle\Entity\Group

    #4041

    Vova Soroka
    Oro Core

    It is ok. The Group entity from the DistributionBundle is located in Security sub directory and Doctrine should not see it as an entity, so these two classes do not conflict each other.

    #4044

    leahaense
    Participant

    Well, it does not seem like it’s ignored. But I’ll investigate a bit further.

    #4046

    leahaense
    Participant

    I get the same error on a fresh install without any additional custom entities…

    #4047

    Vova Soroka
    Oro Core

    It seems very strange. Please let us know if you will find the reason of this error.

    #4048

    leahaense
    Participant

    Entities in subfolders are not ignored, but I found the following in the config.yml under doctrine.orm


    mappings:
    OroDistributionBundle:
    mapping: false
    is_bundle: true

    But since auto_mapping is set to true I believe that these settings are completely ignored

    #4049

    leahaense
    Participant

    Ok, forget about it. I just remembered that I patched the doctrine bundle earlier because of some trouble when using multiple entity managers. apparently that broke this setting with excluding a bundle from the mapping. sorry 🙂

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

You must be logged in to reply to this topic.