aerial-framework/core

Doctrine issue with identifying one-to-one relationship

dannykopping opened this issue · 0 comments

In the following YAML, I have an identifying one-to-one relationship:

Video:
  actAs: [Timestampable]
  tableName: Video
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    videoName:
      type: string(500)
      notnull: true
    userId:
      type: integer(4)
      primary: true
      unsigned: true
      notnull: true
    createdAt:
      type: timestamp
    updatedAt:
      type: timestamp
  relations:
    User:
      class: User
      local: userId
      foreign: id
      foreignAlias: video
      onDelete: cascade
      onUpdate: cascade
  indexes:
    fk_Video_User1:
      fields: [userId]

When trying to save a VideoVO record, I get the following error:
Illegal offset type in isset or empty

This error occurs on line 1202 on Doctrine/Record.php where it checks if the Record has an accessor - this function is expecting a scalar value, but an identifying relationship has two primary keys and the function fails.

We should maybe look for a fix in the Doctrine repo, otherwise we should override it in Aerial_Record.php