mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3622: [GH-1336] Fix UoW warning with custom id object types #4451
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Mar 17, 2015).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of stefanotorresi:
Url: https://github.com/doctrine/doctrine2/pull/1336
Message:
UnitOfWork::tryGetById()andUnitOfWork::tryGetByIdHash()may receive an object as an id, for instance when using a custom id type like Rhumsaa\Uuid.This PR adds a simple cast to string in these methods.
There are a couple of things I'm not sure about, tho.
First of all, I don't know if functional tests alone are deemed sufficient, but I couldn't figure out how to replicate the issue via unit tests only (apart from directly invoking the two methods above with an object as argument, which looks a bit pointless).
Furthermore, I don't know if the cast should be applied elsewhere; so far the only cases I stumbled upon where common find and fetch joins, but I saw other methods where it may be necessary (i.e. here and here), but I couldn't replicate the code path to reach those.
Also I wonder if an exception should be thrown if the id object doesn't implement
**toString(), and in this case if the fix should be refactored intoDoctrine\ORM\Utility\IdentifierFlattener, for a bit of SoC.Let me know what you think.
@doctrinebot commented on GitHub (Mar 17, 2015):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1336] was closed:
https://github.com/doctrine/doctrine2/pull/1336
@doctrinebot commented on GitHub (Mar 17, 2015):
Issue was closed with resolution "Fixed"