我想通过使用具有double manyToOne关系的第三个实体来创建两个entite之间的多个关系:
AppBundle\Entity\AttributeKey:
type: entity
table: attribute_keys
repositoryClass: AppBundle\Repository\AttributeKeyRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
label:
type: string
length: 255
unique: true
sort:
type: integer
AppBundle\Entity\AttributeValue:
type: entity
table: attribute_values
repositoryClass: AppBundle\Repository\AttributeValueRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
label:
type: string
length: 255
unique: true
AppBundle\Entity\AttributeKeyValue:
type: entity
table: attribute_keys_values
repositoryClass: AppBundle\Repository\AttributeKeyValueRepository
manyToOne:
attributeKey:
targetEntity: AttributeKey
attributeValue:
targetEntity: AttributeValue
manyToMany:
documents:
targetEntity: Document
mappedBy: attributes
id:
id:
type: integer
id: true
generator:
strategy: AUTO
在数据库中,一切看起来都很好,外键是正确构建的。但是,由学说生成的AttributeKey
实体不包含方法getValues()
,而AttributeValue
没有方法getKeys()
或addKey()
我做错了什么?
答案 0 :(得分:2)