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-2034: getPartialReference returns partial entities for non existent entities #2712

Closed
doctrinebot opened this issue Sep 17, 2012 · 4 comments
Assignees
Labels

Comments

@doctrinebot
Copy link

Jira issue originally created by user deatheriam:

$variant = $em->getPartialReference('Entity\Variant', -1);
echo $variant->getVariantId();

prints -1. Is it an expected behavior or a bug? Shouldn't a check be made to prevent creating new instances for ids that do not exist?

@doctrinebot
Copy link
Author

Comment created by stof:

Well, the purpose of getPartialReference is to return a reference without querying the database. So it cannot know if the id exists.
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/EntityManager.php#L481

@doctrinebot
Copy link
Author

Comment created by deatheriam:

Ok, in that case a user is responsible for providing a valid id. But what is a use case for such an entity? Can someone give me a real example?

@doctrinebot
Copy link
Author

Comment created by @beberlei:

the use case was partially removed by proxy objects now being capable of returning the id without querying.

@doctrinebot
Copy link
Author

Issue was closed with resolution "Invalid"

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