Improvement? Throw error when key parameter not found #177
Copy link
Copy link
Open
Labels
Description
Hello !
I would like to know if it's possible to throw an error to indicates that a key has not been found in the parameter list ?
For example:
return $this->find('foo = :foo AND bar = :bar AND baz = :baz', [
'foo' => 42,
'baar' => 'Wrong key',
'baz' => null
]);In my code, I expect a key bar that is not provided, and would like to throw an error because my query will be wrongly executed if i mistype a parameter key.
I understand that when a value is null, it should work properly by removing the condition internally. But I expect that for not found key, it should not behave like that.
Is there any way to avoid the query to be executed if a key is missing ?
Thank you !
Reactions are currently unavailable
Activity
moufmouf commentedon Sep 27, 2019
This is an interesting idea but that would be a huge BC break (as people using the current API may rely on the fact that "a key is absent = a key is null")
This should actually be pushed down to the mouf/magic-query package. From there, we can add a "strict" option and we could add a "strict" mode in TDBM that uses magic-query strict mode.