Home Documentation Download Pricing Buy Now
0 votes

I have an object that's mapped to an entity as Embedded in Skipper. It's been working well, and previously it had a single field marked as unique, which worked ok as it was defined in the #[ORM\Column] attribute itself. Now I needed to add a new column and make it a compound unique constraint with two fields. Export from Skipper generated the correct #[ORM\UniqueConstraint(...)] in the same class where the #[ORM\Embeddable] attribute is, but the problem is that Doctrine doesn't support it. I think it should be defined on the main entity itself. And in Skipper, I can't create it there as the UI for selecting fields does not include the embedded fields...

So, a fix would be to either allow selecting embedded fields when defining indexes for an entity in the Skipper UI, or generate the indexes defined in an embedded object directly on the parent entities.

ago in Bug report by (470 points)

1 Answer

0 votes
 
Best answer

Hi,

thank you for the detailed report. We have fixed this in Skipper 3.5.5, which is now available as a beta:

https://www.skipper18.com/support/402/downloads-skipper-beta

What changed for Doctrine 2:

  • An index or unique constraint on an entity can now use fields of its embedded objects. In the index editor, the fields of each Embedded link are listed with their path, for example billingAddress.street, so you can create your compound unique constraint directly on the parent entity.
  • The export writes these fields to the parent entity (PHP attributes, annotations, XML and YAML), in the form that Doctrine expects.
  • Indexes can no longer be defined on an embeddable. When you open an existing project, Skipper moves such indexes to every entity that embeds the object and shows a list of the converted indexes. If an index cannot be converted automatically, the same message lists it for manual changes.

Could you please try the beta with your project and let us know if it works for you?

Best regards,
Ludek

ago by Skipper developer (142k points)
selected ago by

Thanks, it's working now
Nice touch with the automatic migration of the index from the embedded to the main entity.

You are welcome. I'm glad it's working. Feel free to let us know about anything else you find.

...