Hi,
Could anyone explain the technical/architectural problems with the
"Join-Columns with non-primary keys" limitation described here:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/limitations-and-known-issues.html#join-columns-with-non-primary-keys
I have inherited a database which has many tables joined on non-PK columns
(they're actually reference codes external to the system).
An easy to understand example would be an Address table and a Country table:
CREATE TABLE Country (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(64) NOT NULL,
iso2 CHAR(2) NOT NULL,
iso3 CHAR(3) NOT NULL,
INDEX iso2 (iso2),
INDEX iso3 (iso3)
);
INSERT INTO Country (name, iso2, iso3) VALUES ('United Kingdom', 'GB',
'GBR');
CREATE TABLE Address (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
address TEXT,
iso2_country_code CHAR(2) NOT NULL,
INDEX iso2_country_code (iso2_country_code)
);
INSERT INTO Address (address, iso2_country_code) VALUES ('Address data',
'GB');
I would like to join the Address Entity to the Country Entity via
iso2_country_code and iso2 columns respectively which aren't PKs at all.
I can flag the iso2 column on Country as @Id but that causes the Entity to
use compound primary keys which removes the ability for auto increment to
work.
Is there a fundamental Doctrine reason not to allow arbitrary non-PK joins
between entities?
Kind regards,
James.
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.