Skip to content

OneToOne inverse relation is Mapped as OneToMany #150

@homersimpsons

Description

@homersimpsons

SQL Schema:

CREATE TABLE `object` (
  `id` INT NOT NULL,
  PRIMARY KEY (`id`));
CREATE TABLE `media` (
  `id` INT NOT NULL,
  `object_id` INT NOT NULL,
  PRIMARY KEY (`id`),
  FOREIGN KEY fk_object(object_id)
   REFERENCES object(id));

TDBM generate a getter on the Object Entity named getMediasByObjectId(): AlterableResultIterator.

Here, because of the unique index on object_id, the relation is a OneToOne and not a OneToMany, so the generated method should have been getMediaByObjectId(): ?Media (notice the return type is nullable as TDBM can't ensure the existence)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions