Closed TomHAnderson closed 7 years ago
@TomHAnderson Can you add test for your change please?
Why just return
and not throw exception
?
re: why return and not throw an exception
https://github.com/zfcampus/zf-doctrine-querybuilder/blob/master/src/Filter/ORM/AbstractFilter.php#L37 This line also checks for valid fields on the 'row' entity and fails quietly.
These filters, and order by, are intended to be used by third parties and I don't believe a third party should be allowed to cause an exception. Therefore failing quietly is preferred.
My argument against exceptions is poor as the same Field.php contains an exception. I would like to see this work quietly for every case. But I'm open to ideas.
Adding proper exceptions to this library would be useful. We'll catch them in DefaultORM and throw an ApiProblem. I'll continue this PR and build the exception handling.
For the row alias only validate the field exists in the metadata.
This only checks the metadata for the 'row' alias. It would be nice to validate inner join aliases' metadata too in the future.