我尝试通过services.yml
加载我的服务和自定义存储库现在我有:
parameters:
job_entity_name: Marek\JobeetBundle\Entity\Job
category_entity_name: Marek\JobeetBundle\Entity\Category
services:
job_metadata:
class: Doctrine\ORM\Mapping\ClassMetaData
arguments:
name: [%job_entity_name%]
category_metadata:
class: Doctrine\ORM\Mapping\ClassMetaData
arguments:
name: [%category_entity_name%]
job_repo:
class: Marek\JobeetBundle\Repositories\JobRepository
arguments:
em: [@doctrine.orm.entity_manager]
class: [@job_metadata]
category_repo:
class: Marek\JobeetBundle\Repositories\CategoryRepository
arguments:
em: [@doctrine.orm.entity_manager]
class: [@category_metadata]
job_service:
class: Marek\JobeetBundle\JobService
arguments:
jobRepo: [@job_repo]
categoryRepo: [@category_repo]
错误:
注意:数组转换为字符串 d:\杰韦利\ Symfony2的\ Jobeet的\厂商\教义\ lib中\学说\ ORM \映射\ ClassMetadata.php 第66行
我放弃了。有人可以帮忙吗?
[编辑]
当然我的架构很糟糕,正确的是:
services:
job_metadata:
class: Doctrine\ORM\Mapping\ClassMetaData
arguments:
name: "Marek\JobeetBundle\Entity\Job"
category_metadata:
class: Doctrine\ORM\Mapping\ClassMetaData
arguments:
name: "Marek\JobeetBundle\Entity\Category"
job_repo:
class: Marek\JobeetBundle\Repositories\JobRepository
arguments:
em: @doctrine.orm.entity_manager
class: @job_metadata
category_repo:
class: Marek\JobeetBundle\Repositories\CategoryRepository
arguments:
em: @doctrine.orm.entity_manager
class: @category_metadata
job_service:
class: Marek\JobeetBundle\JobService
arguments:
jobRepo: @job_repo
categoryRepo: @category_repo