mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-353: Doctrine thrown exception, when it is trying to remove not initialized proxy. #439
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 (Feb 20, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user cloun:
Introduction:
I have a Product, which has many (OneToMany collection) Pictures. Picture has a File (ManyToOne with cascade={"remove", "persist"}).
The problem:
When I remove a picture from a product
doctrine removes picture, then cascade removes file, but file is not yet initialized. Doctrine tries to check entity state:
The getIdentifierValues method tries to take entity id through reflection, but id field is absent.
I think that the getEntityState method should support case when entity is instance of IProxy...
@doctrinebot commented on GitHub (Feb 20, 2010):
Comment created by cloun:
May be I'm wrong, but as workaround I made the following:
@doctrinebot commented on GitHub (Feb 23, 2010):
Comment created by romanb:
What is the error/exception you are getting? Please show the full stack trace in case of an exception.
@doctrinebot commented on GitHub (Feb 23, 2010):
Comment created by romanb:
This code:
will only remove the association, not the picture or the file, thus remove cascades would not even apply.
@doctrinebot commented on GitHub (Feb 23, 2010):
Comment created by romanb:
Please show the full code you're using (models etc.) and the error or unexpected behavior you're getting, so that we can try to reproduce it.
@doctrinebot commented on GitHub (Feb 23, 2010):
Comment created by cloun:
It will take many time, because my project has a huge infrastructure. I write when I reproduce it in console.
@doctrinebot commented on GitHub (Feb 26, 2010):
Comment created by cloun:
I have attached test project in which I reproduced this problem.
What I did:
Steps for reproducing:
@doctrinebot commented on GitHub (Feb 26, 2010):
Comment created by @beberlei:
Please create a unit-test, in the schema of tests\Doctrine\Tests\ORM\Functional\Ticket and attach it as a .patch or .diff or .php file. This is not a minimal re-produce case that can be easily understood or run by us.
@doctrinebot commented on GitHub (Feb 27, 2010):
Comment created by cloun:
Could you please provide some kind of documentation (or link to it) on how to create such unit tests.
I understand, that my test enviroment is not convenient for you, but it countains only initialization code and issue code. It's a minimal code which required for reproducing. If you spend a little time, you would see...
@doctrinebot commented on GitHub (Feb 28, 2010):
Comment created by @beberlei:
Verified, attached the testcase
@Valery: The attached file shows the test-case for your behaviour, its a stripped down 200 lines php file compared to your 30kb rar file :-)
@doctrinebot commented on GitHub (Feb 28, 2010):
Comment created by @beberlei:
The problem is easily explained:
Reference / Proxy objects are not marked as MANAGED in the UnitOfWork if they are initialized through a hydrator compared to calling
getReference()@doctrinebot commented on GitHub (Feb 28, 2010):
Comment created by @beberlei:
Updated test-case that shows when it works, when it fails.
@doctrinebot commented on GitHub (Feb 28, 2010):
Comment created by @beberlei:
Fixed
@doctrinebot commented on GitHub (Feb 28, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Mar 1, 2010):
Comment created by cloun:
Thanks for the fix!
@Benjamin Eberlei: I see. But know nothing about how you are writing a test-cases. May be it would be useful to provide documentation (simple instruction) about it.Possible, then my experience will bring a little more benefits for you..
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/f049d09b217a5e59f4d5