Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-ALPHA4
-
Fix Version/s: 2.0-BETA1
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
Introduction:
I have a Product, which has many (OneToMany collection) Pictures. Picture has a File (ManyToOne with cascade=
).
The problem:
When I remove a picture from a product
$product->pictures->removeElement($picture); $picture->resetProduct();
doctrine removes picture, then cascade removes file, but file is not yet initialized. Doctrine tries to check entity state:
public function getEntityState($entity, $assume = null)
{
$oid = spl_object_hash($entity);
if ( ! isset($this->_entityStates[$oid])) {
...
if ($assume === null) {
if ($this->_em->getClassMetadata(get_class($entity))->getIdentifierValues($entity)) {
$this->_entityStates[$oid] = self::STATE_DETACHED;
...
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...
Activity
Roman S. Borschel
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Affects Version/s | 2.0-ALPHA4 [ 10036 ] | |
| Fix Version/s | 2.0-BETA1 [ 10030 ] |
Valery Dubrava
made changes -
| Attachment | doctrine2test.rar [ 10396 ] |
Roman S. Borschel
made changes -
| Assignee | Roman S. Borschel [ romanb ] | Benjamin Eberlei [ beberlei ] |
Benjamin Eberlei
made changes -
| Attachment | DDC353Test.php [ 10400 ] |
Benjamin Eberlei
made changes -
| Attachment | DDC353Test.php [ 10401 ] |
Benjamin Eberlei
made changes -
| Attachment | DDC353Test.php [ 10400 ] |
Benjamin Eberlei
made changes -
| Attachment | DDC353Test.php [ 10402 ] |
Benjamin Eberlei
made changes -
| Attachment | DDC353Test.php [ 10401 ] |
Benjamin Eberlei
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Benjamin Eberlei
made changes -
| Workflow | jira [ 10921 ] | jira-feedback [ 14284 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback [ 14284 ] | jira-feedback2 [ 16148 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback2 [ 16148 ] | jira-feedback3 [ 18401 ] |
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-353, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
May be I'm wrong, but as workaround I made the following:
1. Added a _load method to Proxy interface (why it is not called IProxy?)
2. Made the _load method public (in ProxyFactory)
3. Added another one case to getEntityState method:
if ($entity instanceof \Doctrine\ORM\Proxy\Proxy) { $entity->_load(); } elseif ($assume === null) {