PrestaShop 使用 Doctrine & Entities
PrestaShop working with Doctrine & Entites
你好 :) 开始时:我使用 PrestaShop 1.7.6.2 和 MySQL 5.6 和 PHP 7.2
我想用 Symfony Controller 和没有 ObjectModel 的 Entites 以新的方式创建一个模块(因为就像 PrestaShop 的开发者之一:Pablo Borowicz - ObjectModel 已被弃用)
所以一开始我创建了简单的模块,可在 link
https://github.com/DarkSidePro/testmodule
控制器和路由工作完美问题是当我尝试使用实体管理器时
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$testRepository = $entityManager->getRepository(TestmoduleTest::class);
$test = $testRepository->findAll();
我有这样的错误:
The class 'DarkSide\Testmodule\Entity\TestmoduleTest' was not found in the chain configured namespaces PrestaShopBundle\Entity
也许我做错了什么?但是 prestashop of coures 的文档对创建 PrestaShop 模块的新方法很糟糕
正在寻找 4 个帮助:)
谢谢大家 :)
PrestaShop 文档在处理 Symfony 存储库方面完全是一团糟。
Doctrine 正在寻找(通过 auto_mapping
orm 配置属性)您的实体是否存在于 Prestashop Entity
命名空间下,因此假设您的 TestmoduleTest
实体不存在,无法找到并因此无法加载。
您可能需要在以下命名空间下注册 your entity:namespace PrestaShop\Module\Testmodule\Entity;
您将能够在官方 productcomments
模块 here.
中找到有关如何创建自己的存储库 class 的更多信息
好的,问题出在其他方面:)
在这种情况下,我的存储库 class 有问题(可能与此 class 的构造函数有关)
当我删除它们时,模块开始工作
问题已解决:)
你好 :) 开始时:我使用 PrestaShop 1.7.6.2 和 MySQL 5.6 和 PHP 7.2
我想用 Symfony Controller 和没有 ObjectModel 的 Entites 以新的方式创建一个模块(因为就像 PrestaShop 的开发者之一:Pablo Borowicz - ObjectModel 已被弃用)
所以一开始我创建了简单的模块,可在 link https://github.com/DarkSidePro/testmodule
控制器和路由工作完美问题是当我尝试使用实体管理器时
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$testRepository = $entityManager->getRepository(TestmoduleTest::class);
$test = $testRepository->findAll();
我有这样的错误:
The class 'DarkSide\Testmodule\Entity\TestmoduleTest' was not found in the chain configured namespaces PrestaShopBundle\Entity
也许我做错了什么?但是 prestashop of coures 的文档对创建 PrestaShop 模块的新方法很糟糕
正在寻找 4 个帮助:) 谢谢大家 :)
PrestaShop 文档在处理 Symfony 存储库方面完全是一团糟。
Doctrine 正在寻找(通过 auto_mapping
orm 配置属性)您的实体是否存在于 Prestashop Entity
命名空间下,因此假设您的 TestmoduleTest
实体不存在,无法找到并因此无法加载。
您可能需要在以下命名空间下注册 your entity:namespace PrestaShop\Module\Testmodule\Entity;
您将能够在官方 productcomments
模块 here.
好的,问题出在其他方面:) 在这种情况下,我的存储库 class 有问题(可能与此 class 的构造函数有关) 当我删除它们时,模块开始工作 问题已解决:)