Skip to content

Error when using Raw with IN #1079

Closed
Closed
@ggedde

Description

@ggedde

Medoo: 2.1.8
PHP: 8.1
Database: MySql
System: Mac and Linux

Describe the Problem
I am looking for a way to use Raw with the IN statement when using arrays. However when I do so I am get an Error:
"PHP Fatal Error: Uncaught Error: Object of class Medoo\Raw could not be converted to string Medoo.php:556"

Detail Code
Here is an example of my code

$data = $database->select('user', [
    'id',
    'name',
], [
    'id' => [
        Medoo::raw("uuid_to_bin('d9fca370-319b-4529-a15c-0d27d9053ef1')"),
        Medoo::raw("uuid_to_bin('9b629b8c-c1a2-4b7d-aa4b-3d6fa85ca85a')"),
    ]
]);

Expected output
I would expect it to work the same way as using Raw for a single value.
As this works.

$data = $database->select('user', [
    'id',
    'name',
], [
    'id' => Medoo::raw("uuid_to_bin('d9fca370-319b-4529-a15c-0d27d9053ef1')")
]);

Or is there another way to do what I am trying to do.
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions