akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
950 stars 512 forks source link

Tree object class: Akeneo\Pim\Enrichment\Component\Category\Model\Category must have tree metadata at this point #11031

Open davidverbeek opened 4 years ago

davidverbeek commented 4 years ago

I am new to akeneo and symfony and I am trying to create a new category field using below akeneo latest documentaion

https://docs.akeneo.com/3.2/manipulate_pim_data/category/add_new_properties_to_a_category.html#add-non-translatable-properties-to-your-own-category

But when I tried to run php bin/console doctrine:schema:update --dump-sql , I am getting below error

Tree object class: Akeneo\Pim\Enrichment\Component\Category\Model\Category must have tree metadata at this point

I found the similar bug (https://github.com/akeneo/pim-community-dev/issues/7509) but that is in the "Pim\Bundle\CatalogBundle\Entity\Category" and I am having the error in "Akeneo\Pim\Enrichment\Component\Category\Model\Category",

Please let me know where I am missing.

I have added the below code in app/config/config.yml

akeneo_storage_utils: mapping_overrides:

        original: Akeneo\Pim\Enrichment\Component\Category\Model\Category
        override: Acme\Bundle\CatalogBundle\Entity\Category
    -
        original: Akeneo\Pim\Enrichment\Component\Category\Model\CategoryTranslation
        override: Acme\Bundle\CatalogBundle\Entity\CategoryTranslation

When I add the above code in vendor/akeneo/pim-community-dev/app/config/config.yml , then I am getting this message "Nothing to update - your database is already in sync with the current entity metadata."

Please help me.

Doodoune commented 4 years ago

Hi,

It exists different PIM versions. You can found your PIM version in your footer (in the home page). Ex: in demo.akeneo.com - currently we are in 3.2.17 Screenshot from 2019-11-07 09-01-14

Please notice that we have documentation for each version of the PIM. Screenshot from 2019-11-07 09-05-32

So, if you are in version 2.3, follow this link to help you to add a new category according to your PIM version: https://docs.akeneo.com/2.3/manipulate_pim_data/category/add_new_properties_to_a_category.html#add-non-translatable-properties-to-your-own-category

Best regards,

davidverbeek commented 4 years ago

Hello @Doodoune , Thanks for your reply.

My Akeneo version is "Version:CE 3.2.12", and I am referring to https://docs.akeneo.com/3.2/manipulate_pim_data/category/add_new_properties_to_a_category.html url and followed the exact same steps.

But when I execute "php bin/console doctrine:schema:update --dump-sql" command I am getting below error

"Tree object class: Akeneo\Pim\Enrichment\Component\Category\Model\Category must have tree metadata at this point"

Not sure where I am making the mistake. Please let me know.

Thanks

Doodoune commented 4 years ago

Did you clean your cache after adding the new config in config.yml and the parameter in entities.yml?

Did your extension is correctly loaded by your Dependency Injection? # /src/Acme/Bundle/CatalogBundle/DependencyInjection/AcmeAppExtension.php public function load(array $configs, ContainerBuilder $container) { /** ... **/ $loader->load('entities.yml'); }

davidverbeek commented 4 years ago

Hello @Doodoune,

After adding, below mapping override in "app/config/config.yml"

akeneo_storage_utils: mapping_overrides:

        original: Akeneo\Pim\Enrichment\Component\Category\Model\Category
        override: Acme\Bundle\CatalogBundle\Entity\Category
    -
        original: Akeneo\Pim\Enrichment\Component\Category\Model\CategoryTranslation
        override: Acme\Bundle\CatalogBundle\Entity\CategoryTranslation

when I tried to clear my cache using "php bin/console cache:clear --env=dev" command, then also it is giving me the same error

"Tree object class: Akeneo\Pim\Enrichment\Component\Category\Model\Category must have tree metadata at this point".

Basically after writing mapping override in "app/config/config.yml" I cannot able to clear the cache.

But when I write the mapping override code in "vendor/akeneo/pim-community-dev/app/config/config.yml" , then I can able to clear the cache and then when I execute "php bin/console doctrine:schema:update --dump-sql" command I get this message "Nothing to update - your database is already in sync with the current entity metadata." and the category field is not created.

"Dependency Injection" is same as written in the document. Please let me know where I am making mistake.

Thanks.

davidverbeek commented 4 years ago

Hello @Doodoune,

Any updates? basically I cant able to clear the cache when i keep the below mapping in "app/config/config.yml"

akeneo_storage_utils: mapping_overrides:

        original: Akeneo\Pim\Enrichment\Component\Category\Model\Category
        override: Acme\Bundle\CatalogBundle\Entity\Category
    -
        original: Akeneo\Pim\Enrichment\Component\Category\Model\CategoryTranslation
        override: Acme\Bundle\CatalogBundle\Entity\CategoryTranslation

Thanks

freshdevelop commented 3 years ago

Do someone have any updates on this? I'm having this exact problem and I don't know how to fix. (link to the question on stackoverflow: https://stackoverflow.com/questions/65094698/akeneo-bundle-creation)