Comments (9)
I have a similar issue, the solution I found was ->setParameter('owner', $owner, 'uuid_binary') (or ->setParameter('owner', $owner, UuidBinaryType::NAME)) but it could be great if it could work without the type.
from uuid-doctrine.
@ramsey well, the issue is that Doctrine don't seem to recognize an Uuid object as is when pushed as a param in a dql request (and so, try to inject [Object(Ramsey\Uuid\Uuid)]
in the query).
An easy workaround is to give to setParameter
a third param UuidBinaryType::NAME
to help it recognize the type, but it's not obvious.
Looking at Doctrine's internals quickly, it doesn't look like there is a module to help infer a parameter type from the variable type (there is only a basic ParameterTypeInferer::inferType for native types). Not sure there's anything you can do, other than adding this to the doc
from uuid-doctrine.
@orklah just because I was facing the same problem and couldn't find this solution... Where did you find this solution?
from uuid-doctrine.
@nissen-chris I don't really remember, it was a year ago. Maybe something I deducted reading this:
#18
(which is another big issue I had with uuids, there is no good way to pass an array of ids in a request to perform an IN() with SQL)
from uuid-doctrine.
@orklah Thank you for your quick reply!
No problem. I also found the other issue in this repository but was interested if I missed something bc I couldn't find anything helpful except your comment.
from uuid-doctrine.
I have a similar issue, the solution I found was ->setParameter('owner', $owner, 'uuid_binary') (or ->setParameter('owner', $owner, UuidBinaryType::NAME)) but it could be great if it could work without the type.
I got this error with your solution:
request.CRITICAL: Uncaught PHP Exception PHPUnit\Framework\Error\Warning: "strlen() expects parameter 1 to be string, object given" at /usr/src/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/ConversionException.php line 31 {"exception":"[object] (PHPUnit\Framework\Error\Warning(code: 2): strlen() expects parameter 1 to be string, object given at /usr/src/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/ConversionException.php:31)"} {"token":"057f870d-48305172"}
from uuid-doctrine.
I am using the string representation in the entity. The ID will be present as sting in the entity and then turned into the binary representation when it is persisted to the database.
from uuid-doctrine.
Ah, ok, I have UuidInterface
everywhere
from uuid-doctrine.
I apologize for taking so long to look into this issue.
Is this still a problem, or did you find a work-around? What change could I make in ramsey/uuid-doctrine to help?
from uuid-doctrine.
Related Issues (20)
- There is a bug in MariaDB 10.5.9, extremly slowing queris with UUID in binary form HOT 2
- uuid_binary_ordered_time not working with IN expression HOT 8
- Doctrine 3 compatibility HOT 1
- Imcompatible with the latest Doctrine 2.10 HOT 2
- doctrine.dbal.default_connection is set to 'default' and cannot be changed anymore HOT 2
- Deprecation notice after updating from Symfony 5.3 to 5.4 HOT 2
- Tag new release HOT 1
- Supportfor typed property. HOT 4
- Support other types of `EntityManagerInterface` too HOT 2
- Fetching metadata from an entity using the custom strategy is throwing an error. HOT 2
- Node of UUID is 0 HOT 1
- Additional usage of UUID v6/v7 for UuidBinaryOrderedTimeType HOT 7
- Converting my entities ids to uuids
- Tag a new release HOT 1
- Fetching association throws "Unknown parameter type, 116 given" exception HOT 6
- PostgreSQL UUID type returns a binary stream; DB to PHP conversion is always null HOT 5
- Object of class Ramsey\Uuid\Lazy\LazyUuidFromString could not be converted to int HOT 1
- Doctrine/dbal v4 is out!
- Symfony/Doctrine fail to find an entity based off of its binary UUID HOT 3
- Cannot bind uuid_binary type to Doctrine's QueryBuilder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uuid-doctrine.