nextras / orm

Orm with clean object design, smart relationship loading and powerful collections.
https://nextras.org/orm
MIT License
309 stars 59 forks source link

Unknown column in HAVING clause #662

Closed stepapo closed 7 months ago

stepapo commented 7 months ago

Describe the bug

I tried RC version of 5.0 and so far so good except for one thing in MySQL. It's connected to this comment. That bug was fixed, difference is in IColletion::OR operator. The reason remains the same, two columns with the same name from different tables in HAVING clause. This works in 4.0

To Reproduce

$books = $this->orm->books->findBy([
  ICollection::OR,
  'tags->id' => 1,
  'author->name' => 'Writer 1',
  'publisher->name' => 'Nextras publisher A',
]);
Assert::same($books->count(), 3);

MySQL: Unknown column 'author.name' in 'having clause'

Versions

hrach commented 7 months ago

Thank you for testing and this report. It seems now there is a lot of "infrastructure" to be able to fix this :)

stepapo commented 7 months ago

Thank you for the fix, that was very fast :-) Works great.