coldbox-modules / quick

A ColdBox ORM Engine
https://quick.ortusbooks.com
MIT License
23 stars 19 forks source link

Update HasOneOrMany Relationship Class to Allow Returning a New Entity #244

Closed homestar9 closed 3 months ago

homestar9 commented 8 months ago

Being able to create a new HasOneOrMany relationship entity is great, but sometimes you need access to the new entity before persistence. Adding a newEntity() method gives additional flexibility and also plays nicely with other relationship types.

Additionally, being able to call something like prc.post.postCategories().newEntity() is much cleaner than using the current workaround, which is prc.post.postCategories().getRelated().newEntity()

homestar9 commented 8 months ago

@elpete I'm not sure why the format test failed, but all other tests appear to have passed. Please let me know if you have any feedback or questions about this PR. It will make a nice addition to entity relationships.

I also updated the docs and submitted a review.

homestar9 commented 8 months ago

@elpete, I'm sure you're swamped with other projects, so there's no rush on this PR. I just want to check in to make sure you received the notification about this PR and the other pending ones.