'Getting in Sylius: No mapping found for field 'productTaxon' on class 'App\Entity\Product\Product'
When I go to the route /admin/products/taxon/931 I get an error. I don't understand. I don't even have a field productTaxon in Product entity.
Doctrine\ORM\Mapping\MappingException:
No mapping found for field 'productTaxon' on class 'App\Entity\Product\Product'.
at vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php:163
at Doctrine\ORM\Mapping\MappingException::mappingNotFound('App\\Entity\\Product\\Product', 'productTaxon')
(vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:1256)
at Doctrine\ORM\Mapping\ClassMetadataInfo->getAssociationMapping('productTaxon')
(vendor/sylius/grid-bundle/src/Bundle/Doctrine/ORM/ExpressionBuilder.php:197)
at Sylius\Bundle\GridBundle\Doctrine\ORM\ExpressionBuilder->resolveFieldByAddingJoins('o.productTaxon.position')
(vendor/sylius/grid-bundle/src/Bundle/Doctrine/ORM/ExpressionBuilder.php:154)
at Sylius\Bundle\GridBundle\Doctrine\ORM\ExpressionBuilder->addOrderBy('productTaxon.position', 'asc')
(vendor/sylius/grid-bundle/src/Component/Sorting/Sorter.php:36)
at Sylius\Component\Grid\Sorting\Sorter->sort(object(DataSource), object(Grid), object(Parameters))
(vendor/sylius/grid-bundle/src/Component/Data/DataProvider.php:50)
at Sylius\Component\Grid\Data\DataProvider->getData(object(Grid), object(Parameters))
(vendor/sylius/resource-bundle/src/Bundle/Grid/View/ResourceGridViewFactory.php:51)
at Sylius\Bundle\ResourceBundle\Grid\View\ResourceGridViewFactory->create(object(Grid), object(Parameters), object(Metadata), object(RequestConfiguration))
(vendor/sylius/resource-bundle/src/Bundle/Grid/Controller/ResourcesResolver.php:60)
at Sylius\Bundle\ResourceBundle\Grid\Controller\ResourcesResolver->getResources(object(RequestConfiguration), object(ProductRepository))
(vendor/sylius/resource-bundle/src/Bundle/Controller/ResourcesCollectionProvider.php:43)
at Sylius\Bundle\ResourceBundle\Controller\ResourcesCollectionProvider->get(object(RequestConfiguration), object(ProductRepository))
(vendor/sylius/resource-bundle/src/Bundle/Controller/ResourceController.php:157)
at Sylius\Bundle\ResourceBundle\Controller\ResourceController->indexAction(object(Request))
(vendor/symfony/http-kernel/HttpKernel.php:146)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:68)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:201)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(public/index.php:25)
Validation is ok I guess:
root@64f408a09f91:/srv/sylius# bin/console doctrine:schema:validate
Mapping
-------
[FAIL] The entity-class App\Entity\Product\Product mapping is invalid:
* The field App\Entity\Product\Product#depositData is on the inverse side of a bi-directional relationship, but the specified mappedBy association on the target-entity App\Entity\Product\ProductDeposit#product does not contain the required 'inversedBy="depositData"' attribute.
[FAIL] The entity-class App\Entity\Product\ProductVariant mapping is invalid:
* The field App\Entity\Product\ProductVariant#stockItems is on the inverse side of a bi-directional relationship, but the specified mappedBy association on the target-entity Nordcode\SyliusStockPlugin\Entity\StockItem#productVariant does not contain the required 'inversedBy="stockItems"' attribute.
Database
--------
[OK] The database schema is in sync with the mapping files.
Cache is cleared, dev mode :(
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
