Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot filter using equalTo/endAt/startAt with strings #64

Open
Mogball opened this issue Feb 27, 2017 · 2 comments
Open

Cannot filter using equalTo/endAt/startAt with strings #64

Mogball opened this issue Feb 27, 2017 · 2 comments

Comments

@Mogball
Copy link

Mogball commented Feb 27, 2017

Trying to do $database->ref('some/path')->orderByChild('childname').equalTo('stringvalue')->...

Will throw an error: "Constraint index field must be a JSON primitive".

So it seems strings don't work, but performing the same query in, say, javascript Firebase, is allowed with strings.

@mastef
Copy link

mastef commented Jun 18, 2019

@Mogball See https://stackoverflow.com/a/41991196/10728554 or #58 about adding quotes around your strings.

Also the updated documentation has a case for this https://github.com/ktamas77/firebase-php#supported-commands.

@forcequit
Copy link

Adding to @Masref

The key value must also be json encoded:

$key =json_encode("206");
$value = $firebase->get($path, array('orderBy' => '"url"', 'equalTo' => $key));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants