Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapping is invalid when Add New Properties to a Category #9833

Closed
jcpla opened this issue Mar 27, 2019 · 9 comments
Closed

mapping is invalid when Add New Properties to a Category #9833

jcpla opened this issue Mar 27, 2019 · 9 comments

Comments

@jcpla
Copy link

jcpla commented Mar 27, 2019

V3.0.8

Hello,
I hope I didn't made a mistake but I have a problem with the documentation "How to Add New Properties to a Category"
https://docs.akeneo.com/3.0/manipulate_pim_data/category/add_new_properties_to_a_category.html

I've install a fresh new akeneo version to be sure following : https://docs.akeneo.com/3.0/install_pim/manual/installation_ce_archive.html

Validate the connection on the backoffice and then I've followed every steps (same bundles folder and files) until https://docs.akeneo.com/3.0/manipulate_pim_data/category/add_new_properties_to_a_category.html#define-the-category-form

php bin/console doctrine:schema:update --dump-sql
php bin/console doctrine:schema:update --force

Which was OK, but then I put the command to validate the mapping

# bin/console doctrine:schema:validate 
[Mapping]  FAIL - The entity-class 'Acme\Bundle\CatalogBundle\Entity\Category' mapping is invalid:
* The target entity 'Akeneo\Pim\Enrichment\Component\Category\Model\CategoryTranslationInterface' specified on Acme\Bundle\CatalogBundle\Entity\Category#translations is unknown or not an entity.

[Database] OK - The database schema is in sync with the mapping files.

I was migrating from 2.3 to 3 but I have the same mapping errors for our custom entities

I'm not sure on what to do now.

Thanks for your input and your help.

@Doodoune
Copy link
Contributor

Doodoune commented Apr 2, 2019

Hi @jcpla!
Can you send the content return by the command php bin/console doctrine:schema:update --dump-sql ?

@jcpla
Copy link
Author

jcpla commented Apr 2, 2019

Hi Doodoune,
here is the output.

# php bin/console doctrine:schema:update --dump-sql 
Nothing to update - your database is already in sync with the current entity metadata.

#  bin/console doctrine:schema:validate 
[Mapping]  FAIL - The entity-class 'Acme\Bundle\CatalogBundle\Entity\Category' mapping is invalid:
* The target entity 'Akeneo\Pim\Enrichment\Component\Category\Model\CategoryTranslationInterface' specified on Acme\Bundle\CatalogBundle\Entity\Category#translations is unknown or not an entity.

[Database] OK - The database schema is in sync with the mapping files.

Thank you for your help.

@Doodoune
Copy link
Contributor

Doodoune commented Apr 2, 2019

I found some link that talks about this kind of errors :
Sylius/Sylius#3429
Sylius/Sylius#8739

@jcpla
Copy link
Author

jcpla commented Apr 3, 2019

Hi,
I've seen these issues and the solutions proposed are not working.

Sylius/Sylius#3429 :

  • propose to move the custom bundles before the rest : It's not working.
  • don't work with interfaces in ORM

Sylius/Sylius#8739 :

  • override the mapping with no interfaces

I can't overwrite the entity and relations to other entities the way you describe it in https://docs.akeneo.com/3.0/manipulate_pim_data/category/add_new_properties_to_a_category.html#configure-the-mapping-override

define the mapping for your own field only:

# app/config/config.yml
akeneo_storage_utils:
    mapping_overrides:
        -
            original: Akeneo\Pim\Enrichment\Component\Category\Model\Category
            override: Acme\Bundle\CatalogBundle\Entity\Category

I still have the same error if i change the translation field :

# /src/Acme/Bundle/CatalogBundle/Resources/config/doctrine/Category.orm.yml
    oneToMany:
        translations:
            targetEntity: Akeneo\Pim\Enrichment\Component\Category\Model\CategoryTranslation
            mappedBy: foreignKey
            cascade:
                - persist
                - detach
            orphanRemoval: true

Is there another way to override the whole entity ?

Can you reproduce my problem if you follow your documentation ? Should it be updated ?
Thanks

@jcpla
Copy link
Author

jcpla commented Apr 29, 2019

Hi @Doodoune ,
The problem is still present on version 3.0.14

akeneo/pim-docs#1128
#9953

Will you have a closer look on it ?

Thanks

@jcpla jcpla closed this as completed Apr 29, 2019
@jcpla jcpla reopened this Apr 29, 2019
@Thijzer
Copy link
Contributor

Thijzer commented May 8, 2019

A small update.

We had a similar issue and where able to pinpoint the issue with the latest version bump of symfony v3.4.4 => v3.4.22 by forking the CE-dev and rollback that symfony version.

It appears to have something to do with the doctrine ORM mappings and how the Symfony bridge component handles them. No futher details so far as we don't have the time to scope this.
But maybe this hint might trigger someone to dive in.

This commit somewhat resolves our issue /
https://github.com/induxx/pim-community-dev/commit/3b4baac6193b9522a688425a96bd9f2ff9823552

@afserali
Copy link

Same Error i am getting . Any Solution for this? I am using 3.1

[FAIL] The entity-class Acme\Bundle\CatalogBundle\Entity\Category mapping is invalid:

  • The target entity 'Akeneo\Pim\Enrichment\Component\Category\Model\CategoryTranslationInterface' specified on Acme\Bundle\CatalogBundle\Entity\Category#translations is unknown or not an entity.

[FAIL] The entity-class Acme\Bundle\CatalogBundle\Entity\CategoryTranslation mapping is invalid:

  • The target entity 'Akeneo\Pim\Enrichment\Component\Category\Model\CategoryInterface' specified on Acme\Bundle\CatalogBundle\Entity\CategoryTranslation#foreignKey is unknown or not an entity.

@gauquier
Copy link

@afserali, The problem is fixed in version 3.1.4

@Doodoune
Copy link
Contributor

Doodoune commented Jul 4, 2019

Hi all!

We release a new fix of our documentation. It contains a fix for the "how to add a new property to a category" page.

https://docs.akeneo.com/3.0/manipulate_pim_data/category/add_new_properties_to_a_category.html

Please, clean your browser cache to show the new version.

Regards,

@Doodoune Doodoune closed this as completed Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants