学说2:无法正确设置OneTo许多关系

I have 2 entities: Interview and Comment. Interview has one to many unidirectional relation with Comment.

Here is my yaml mapping file for Comment:

Entities\Comment:
  type: entity
  table: Comment
  repositoryClass: Repositories\CommentRepository

  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO
    parentid:
      type: integer
      nullable: false
      column: parentid
    isactive:
      type: integer
      nullable: false
      column: isactive
    isremoved:
      type: integer
      nullable: false
      column: isremoved
    removaldate:
      type: datetime
      nullable: true
      column: removaldate
    user_name:
      type: string
      length: 255
      nullable: false
      column: user_name
    user_email:
      type: string
      length: 255
      nullable: false
      column: user_email
    user_avatar:
      type: string
      length: 255
      nullable: false
      column: user_avatar
    comment:
      type: text
      nullable: false
      column: comment
    creationdate:
      type: datetime
      nullable: false
      column: creationdate
    rating:
      type: integer
      nullable: false

Here is my yaml mapping file for Interview:

Entities\Interview:
  type: entity
  table: Interview
  repositoryClass: Repositories\InterviewRepository

  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO
    isremoved:
      type: integer
      nullable: false
      column: isremoved
    removaldate:
      type: datetime
      nullable: true
      column: removaldate
    creationdate:
      type: datetime
      nullable: false
      column: creationdate
    rating:
      type: integer
      nullable: false
    anonstitle:
      type: string
      length: 1000
      nullable: false
      column: anonstitle
    anons:
      type: text
      nullable: false
      column: anons
    anonsphoto:
      type: string
      length: 255
      nullable: true
      column: anonsphoto
    interviewtitle:
      type: string
      length: 1000
      nullable: false
      column: interviewtitle
    interview:
      type: text
      nullable: true
      column: interview
    interviewphoto:
      type: string
      length: 255
      nullable: true
      column: interviewphoto
  manyToMany:
    comments:
      targetEntity: Comment
      joinTable:
        name: interviews_comments
        joinColumns:
          interview_id:
            referencedColumnName: id
        inverseJoinColumns:
          comment_id:
            referencedColumnName: id
            unique: true

So after loading schema to database, i have 3 tables. 2 of them are tables of entities, one is for relation and it has just 2 columns: interview_id, comment_id. But after persisting Comment objects for some Interview i dont see anything in join table. Can't find out why.

Interview has one to many unidirectional relation with Comment.

No, because you defined this relation as manyToMany in Entities\Interview, not unidirectional oneToMany in owning side.

ManyToMany mapping requeres a join table. Because one Interview can have many Comment and one Comment can have many Interview. This problem cannot be sloved with additional attributes in database tables, so the additional mapping table is created.

Solution: If you want to have a one Interview with many Comment, but one Comment have one Interview, you have to correct the mapping in yaml Entities\Interview to oneToMany without joinTable (as you defined and it is created).