coldbox-modules / quick

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

Fixed multiple v5 regressions #199

Closed ryanalbrecht closed 2 years ago

ryanalbrecht commented 2 years ago

in reference to issue #198. In the forwardToQB method, instead of creating a new quickBuilder each time this method is called cache the builder in the entity. This allows you to correctly chain where clauses. Performance is not impacted as in v4 a quickBuilder was injected into every quick entity class. This will still only instantiate the quick builder when needed

in reference to issue #194. When calling retrieveQuery on a relationship instance the relationshipBuilder is returned directly instead of calling retrieveQuery on the actual relationshipBuilder instance.

In addition there is a regression in v5 when calling .with() on an entity. In v4 the quick entity is returned whereas in v5 a quickBuilder is returned. This is causing issues as I have my own BaseEntity class which implements additional logic to constrain queries, further breaking method chaining. I solved this by returning the entity instead of the QuickBuidler. This will still work as method calls intended for the quickbuilder will be forwarded onto the quickBuilder in the onMissingMethod in the BaseEntity class