Basic question:
Is it possible to map an association using Doctrine referencing not a primary but only a unique key?
Extended Versio
Just like following references, Doctrine does not support this type of mapping
http://www.doctrine-project.org/jira/browse/DDC-1269
http://www.doctrine-project.org/jira/browse/DDC-1114
I think it will be helps to you.
Since I did not get any answer yet I did another research today and I found the answer to my own question through the Doctrine mailing lists forum. Seems like I just searched for the wrong keywords...
Doctrine 2 unfortunately does not support it. What a pity! :(
From the Doctrine documentation: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/limitations-and-known-issues.html#join-columns-with-non-primary-keys
It is not possible to use join columns pointing to non-primary keys. Doctrine will think these are the primary keys and create lazy-loading proxies with the data, which can lead to unexpected results. Doctrine can for performance reasons not validate the correctness of this settings at runtime but only through the Validate Schema command.
Similar question: Is it possible to reference a column other than 'id' for a JoinColumn?