Skip to content

Improvement? Throw error when key parameter not found #177

Open

Description

@Zheness

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 !

Activity

  1. moufmouf commented on Sep 27, 2019

    @moufmouf
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions