Open jasonlfunk opened 8 years ago
Embeddables is a Doctrine 2.5 feature. Yes it's not supported by the library yet. I'll have a look at the issue. Please feel free to contribute!
ok! Embeddables are the breeze equivalent of Complex Types.
Relating to your issue: The Doctrine documentation says embeddables don’t have a primary key
which makes sense as they are not entities, but your UUID
embeddable has a primary key like an entity. I think it is wrong. Second, your Expense
entity has a primary key which is type of an embeddable. I wonder if Doctrine library supports Embeddable to be a primary key of en entity type.
Hi - thanks for responding.
1) You are right that an embeddable doesn't have a primary key because they aren't entities. However, they can provide the primary key for another entity. This setup is currently working fine with my application.
2) Expense
doesn't have a primary key directly (there is no @Id mapping on it). It get's inherited from the UUID
embeddable.
Here are the relevant parts of the generated mapping:
+-------------------------------+--------------------------------------------+
| Field | Value |
+-------------------------------+--------------------------------------------+
| Name | Expense |
| Root entity name |Expense |
| Custom generator definition | None |
| Custom repository class | None |
| Mapped super class? | False |
| Embedded class? | False |
| Parent classes | Empty |
| Sub classes | Empty |
| Embedded classes | Empty |
| Identifier | ["id.id"] |
| Inheritance type | 1 |
| Discriminator column | None |
| Discriminator value | None |
| Discriminator map | Empty |
| Generator type | 5 |
| Table | {"name":"Expense"} |
| Composite identifier? | False |
| Foreign identifier? | False |
| Sequence generator definition | None |
| Table generator definition | None |
| Association mappings: | |
| id.id | |
| fieldName | id.id |
| type | string |
| length | Null |
| unique | False |
| nullable | False |
| id | True |
| columnName | id |
| originalClass | UUID |
| declaredField | id |
| originalField | id |
+-------------------------------+--------------------------------------------+
+-------------------------------+---------------------------+
| Field | Value |
+-------------------------------+---------------------------+
| Name | UUID |
| Root entity name | UUID |
| Custom generator definition | None |
| Custom repository class | None |
| Mapped super class? | False |
| Embedded class? | True |
| Parent classes | Empty |
| Sub classes | Empty |
| Embedded classes | Empty |
| Named queries | Empty |
| Named native queries | Empty |
| SQL result set mappings | Empty |
| Identifier | ["id"] |
| Inheritance type | 1 |
| Discriminator column | None |
| Discriminator value | None |
| Discriminator map | Empty |
| Generator type | 5 |
| Table | {"name":"UUID"} |
| Composite identifier? | False |
| Foreign identifier? | False |
| Sequence generator definition | None |
| Table generator definition | None |
| Change tracking policy | 1 |
| Versioned? | None |
| Version field | None |
| Read only? | False |
| Entity listeners | Empty |
| Association mappings: | |
| Field mappings: | |
| id | |
| fieldName | id |
| type | string |
| scale | Empty |
| length | Null |
| unique | False |
| nullable | False |
| precision | Empty |
| id | True |
| columnName | id |
+-------------------------------+---------------------------+
I was hoping something would just ring a bell and there would be an easy fix. I don't have too much experience with Reflection and what-not. But I'll definitely dig into it a little more too.
I have my keys stored in a UUID value object. When this is generating the metadata, the isPartOfKey flag is not being properly set for the classes.
Example:
The generated Metadata looks like this:
It appears that
Embeddables
aren't being evaluated correctly.