Doctrine 2 mapping referencing unique key



PHP Snippet 1:

### UserEntity.dcm.yml
UserEntity:
type: entity
repositoryClass: UserRepository
table: User
id:
  id:
    type: integer
      nullable: false
      length: 9
      options:
        unsigned: true
      id: true
      column: id
      generator:
        strategy: AUTO
  fields:
    status:
      type: integer
      nullable: false
      length: 2
      options:
        fixed: false
      column: status
    dateOfBirth:
      type: datetime
      nullable: true
      options:
        fixed: false
      column: date_of_birth
    createdAt:
      type: datetime
      nullable: true
      options:
        fixed: false
      column: created_at
  userAvatar:
    targetEntity: AvatarEntity
    joinColumn:
      name: id
      referencedColumnName: user_id
  lifecycleCallbacks: {  }


### AvatarEntity.dcm.yml
User/AvatarEntity:
  type: entity
  repositoryClass: AvatarRepository
  table: Avatar
  id:
    userId:
      type: integer
      nullable: false
      length: 9
      options:
        unsigned: true
      id: true
      column: user_id
      generator:
        strategy: NONE
  fields:
    imageName:
      type: string
      nullable: false
      length: 255
      options:
        fixed: false
      column: image_name
  lifecycleCallbacks: {  }