Symfony的發電機產生的下面的類儲存庫的:如何配置依賴注入庫類的symfony 3
namespace AppBundle\Repository;
use AppBundle\Entity\GroupEntity;
/**
* GroupEntityRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class GroupEntityRepository extends \Doctrine\ORM\EntityRepository
{
}
services.yml:
group_entity_repository:
class: AppBundle\Repository\GroupEntityRepository
arguments: ["@doctrine.orm.entity_manager", AppBundle\Entity\GroupEntity]
我配置錯誤services.yml,但我現在不要用什麼作爲第二個參數。所以我得到的錯誤:
Catchable Fatal Error: Argument 2 passed to Doctrine\ORM\EntityRepository::__construct() must be an instance of Doctrine\ORM\Mapping\ClassMetadata, string given, called in E:\other\dropbox\Dropbox\programavimas\kodo pavyzdziai\htdocs\users_admin_demo\var\cache\dev\appDevDebugProjectContainer.php on line 1626 and defined
如何解決它?我在文檔中看不到它,它只顯示了生成器和最終生成的類的代碼,但沒有顯示服務配置。
找到本主題(http://stackoverflow.com/questions/17228417/symfony-2-creating-a-service-from-a -repository),它可能可以幫助你。 –