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

Notice: Array to string conversion if criteria array has no values #47

Closed
forgie1 opened this issue Nov 7, 2017 · 8 comments
Closed

Comments

@forgie1
Copy link

forgie1 commented Nov 7, 2017

This code

$ids = []
Doctrine\ORM\EntityRepository::findBy([
	'id' => $ids,
]);

in 1.4.2 version generates Array to string conversion Notice in ...\Doctrine\DBAL\Driver\PDOStatement.php:105

Previous version 1.4.1 didn't results to Notice in this case.

This happens on 10.1.21-MariaDB with last Doctrine version.

@ramsey
Copy link
Owner

ramsey commented Nov 7, 2017

Which type are you using? UuidBinaryType or UuidBinaryOrderedTimeType?

@enumag, can you look into this? Is this possibly a result of the changes in #45? I might roll a hotfix soon that reverts those changes until I can find a resolution for this.

Thanks!

@forgie1
Copy link
Author

forgie1 commented Nov 7, 2017

Thank you for reply

I use Ramsey\Uuid\Doctrine\UuidBinaryType::class bytes got by Ramsey\Uuid::uuid1()->getBytes().

@enumag
Copy link
Contributor

enumag commented Nov 7, 2017

Hmm... yes, this does look like something caused by #45. I'll have a closer look tomorrow.

@ramsey
Copy link
Owner

ramsey commented Nov 7, 2017

I've reverted #45 in release 1.4.3. @forgie1, please try 1.4.3 and let me know if that fixes the problem you were facing.

@forgie1
Copy link
Author

forgie1 commented Nov 8, 2017

I have used before in composer:

"conflict": {
    "ramsey/uuid-doctrine": "1.4.2"
}

Both 1.4.1 and now 1.4.3 don't throw this notice.

@enumag
Copy link
Contributor

enumag commented Nov 8, 2017

I don't think it's possible to fix this issue. However after inspecting the internals of doctrine/dbal I don't think it's worth fixing.

The main problem is in the readme of this package. I'm rather new to UUIDs so I believed that the documentation was correct which it isn't. It says that UuidType uses CHAR(36) (and that's obviously bad for indexing so binary type seems better at first glance). This is true for MySQL and MariaDB. However for PostgreSQL this is incorrect. UuidType will use the internal UUID datatype on PostgreSQL and it's probably safe to assume that this type could easily be even faster for indexing uuids than bytea. It should be noted that UuidBinaryType is a MySQL/MariaDB specific optimization and that UuidType is just fine for PostgreSQL.

@flaushi
Copy link

flaushi commented Oct 29, 2018

@enumag , is this still true as of today (I expect yes)?
I am deploying my project to PostgreSQL and MySQL databases and would like to have one type that is good for all database systems. Can you recommend one to me?

@enumag
Copy link
Contributor

enumag commented Oct 29, 2018

@flaushi Sorry, I'm only using PostgreSQL so I don't know what is best when using both MySQL and PostgreSQL. I would not recommend it.

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

4 participants