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

DDC-3967: Identifier is cached with wrong type #4827

Closed
doctrinebot opened this issue Oct 30, 2015 · 2 comments
Closed

DDC-3967: Identifier is cached with wrong type #4827

doctrinebot opened this issue Oct 30, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@doctrinebot
Copy link

Jira issue originally created by user janlanger:

Consider this entity:

/****
 * @ORM\Entity
 * @ORM\Cache(usage="READ_ONLY")
 */
class Foo
{

/****
 * @ORM\Id()
 * @ORM\Columns(type="integer")
 * @var integer
 */
private $id;

// ... rest of entity
}

The entity is loaded like this:

$this->em->find(Foo::class, "123");

(note the integer identifier passed as string). When entity is loaded directly from database, the value in property "id" is integer. But second time, when the entity is loaded from second level cache, the id property will have string value "123".

It is caused by this line https://github.com/doctrine/doctrine2/blob/d72ad9cc50208153160edfa9b3bd7a23fbec0cee/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php#L76 where value in original data is overriden by data from cache key.

This is btw second bug i found caused by this line, the previous is #DDC-3950

@doctrinebot
Copy link
Author

@doctrinebot
Copy link
Author

Issue was closed with resolution "Fixed"

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

No branches or pull requests

2 participants