Bug #26582

Repository remove() throws error even if __identity is furnished

Added by Regine Rosewich about 10 years ago. Updated almost 10 years ago.

Status:
Rejected
Priority:
Must have
Category:
Persistence
Start date:
2011-05-03
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

The attempt to remove an object from the repository throws an error even if the __identity (flow3_persistence_identifier) is furnished. If the object to remove is explicitly
searched with a query before removing it, the remove() works. Maybe the object-constellation causes the error as the 'complete' object consist of an abstract-object and the real-object joined with @InheritanceType("JOINED").

The error-message is as follows:

A detached entity can not be removed. #0 /Applications/MAMP/htdocs/FLOW3/Packages/Framework/FLOW3/Resources/PHP/Doctrine/ORM/UnitOfWork.php(1264): Doctrine\ORM\UnitOfWork->doRemove(Object(F3\WeluPdm\Domain\Model\Stammdaten\Klasse), Array)
#1 /Applications/MAMP/htdocs/FLOW3/Packages/Framework/FLOW3/Resources/PHP/Doctrine/ORM/EntityManager.php(472): Doctrine\ORM\UnitOfWork->remove(Object(F3\WeluPdm\Domain\Model\Stammdaten\Klasse))
#2 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_Persistence_Doctrine_PersistenceManager_Original.php(147): Doctrine\ORM\EntityManager->remove(Object(F3\WeluPdm\Domain\Model\Stammdaten\Klasse))
#3 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_Persistence_Doctrine_Repository_Original.php(100): F3\FLOW3\Persistence\Doctrine\PersistenceManager_Original->remove(Object(F3\WeluPdm\Domain\Model\Stammdaten\Klasse))
#4 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_WeluPdm_Service_ExtDirect_V1_Controller_Stammdaten_KlassifizierungController_Original.php(200): F3\FLOW3\Persistence\Doctrine\Repository_Original->remove(Object(F3\WeluPdm\Domain\Model\Stammdaten\Klasse))
#5 [internal function]: F3\WeluPdm\Service\ExtDirect\V1\Controller\Stammdaten\KlassifizierungController_Original->removeKlasseAction(Object(F3\WeluPdm\Domain\Model\Stammdaten\Klasse))
#6 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_MVC_Controller_ActionController_Original.php(283): call_user_func_array(Array, Array)
#7 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_MVC_Controller_ActionController_Original.php(183): F3\FLOW3\MVC\Controller\ActionController_Original->callActionMethod()
#8 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_MVC_Dispatcher_Original.php(106): F3\FLOW3\MVC\Controller\ActionController_Original->processRequest(Object(F3\FLOW3\MVC\Web\Request), Object(F3\ExtJS\ExtDirect\TransactionResponse))
#9 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_MVC_Dispatcher.php(101): F3\FLOW3\MVC\Dispatcher_Original->dispatch(Object(F3\FLOW3\MVC\Web\Request), Object(F3\ExtJS\ExtDirect\TransactionResponse))
#10 [internal function]: F3\FLOW3\MVC\Dispatcher->dispatch(Object(F3\FLOW3\MVC\Web\Request), Object(F3\ExtJS\ExtDirect\TransactionResponse))
#11 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_MVC_Dispatcher.php(89): call_user_func_array(Array, Array)
#12 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_AOP_Advice_AdviceChain_Original.php(74): F3\FLOW3\MVC\Dispatcher->FLOW3_AOP_Proxy_invokeJoinPoint(Object(F3\FLOW3\AOP\JoinPoint))
#13 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_Security_Aspect_RequestDispatchingAspect_Original.php(131): F3\FLOW3\AOP\Advice\AdviceChain_Original->proceed(Object(F3\FLOW3\AOP\JoinPoint))
#14 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_AOP_Advice_AroundAdvice_Original.php(48): F3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original->setAccessDeniedResponseHeader(Object(F3\FLOW3\AOP\JoinPoint))
#15 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_AOP_Advice_AdviceChain_Original.php(72): F3\FLOW3\AOP\Advice\AroundAdvice_Original->invoke(Object(F3\FLOW3\AOP\JoinPoint))
#16 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_Security_Aspect_RequestDispatchingAspect_Original.php(92): F3\FLOW3\AOP\Advice\AdviceChain_Original->proceed(Object(F3\FLOW3\AOP\JoinPoint))
#17 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_AOP_Advice_AroundAdvice_Original.php(48): F3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original->blockIllegalRequestsAndForwardToAuthenticationEntryPoints(Object(F3\FLOW3\AOP\JoinPoint))
#18 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_AOP_Advice_AdviceChain_Original.php(72): F3\FLOW3\AOP\Advice\AroundAdvice_Original->invoke(Object(F3\FLOW3\AOP\JoinPoint))
#19 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_Security_Aspect_RequestDispatchingAspect_Original.php(75): F3\FLOW3\AOP\Advice\AdviceChain_Original->proceed(Object(F3\FLOW3\AOP\JoinPoint))
#20 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_AOP_Advice_AroundAdvice_Original.php(48): F3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original->initializeSecurity(Object(F3\FLOW3\AOP\JoinPoint))
#21 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_AOP_Advice_AdviceChain_Original.php(72): F3\FLOW3\AOP\Advice\AroundAdvice_Original->invoke(Object(F3\FLOW3\AOP\JoinPoint))
#22 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_FLOW3_MVC_Dispatcher.php(115): F3\FLOW3\AOP\Advice\AdviceChain_Original->proceed(Object(F3\FLOW3\AOP\JoinPoint))
#23 /Applications/MAMP/htdocs/FLOW3/Data/Temporary/Development/Cache/Code/FLOW3_Object_Classes/F3_ExtJS_ExtDirect_RequestHandler_Original.php(115): F3\FLOW3\MVC\Dispatcher->dispatch(Object(F3\FLOW3\MVC\Web\Request), Object(F3\ExtJS\ExtDirect\TransactionResponse))
#24 /Applications/MAMP/htdocs/FLOW3/Packages/Framework/FLOW3/Classes/Core/Bootstrap.php(320): F3\ExtJS\ExtDirect\RequestHandler_Original->handleRequest()
#25 /Applications/MAMP/htdocs/FLOW3/Packages/Framework/FLOW3/Classes/Core/Bootstrap.php(174): F3\FLOW3\Core\Bootstrap->handleWebRequest()
#26 /Applications/MAMP/htdocs/FLOW3/Web/index.php(38): F3\FLOW3\Core\Bootstrap->run()
#27 {main}

#1

Updated by Regine Rosewich about 10 years ago

And here's the query preliminary to the faulty remove()

11-05-03 13:01:49 12529      DEBUG     FLOW3                SELECT t1.flow3_persistence_identifier AS flow3_persistence_identifier2, t1.neuanlagedatum AS neuanlagedatum3, t1.aenderungdatum AS aenderungdatum4, t0.klasse AS klasse5, t0.bezeichnung AS bezeichnung6, t0.anzeigefolge AS anzeigefolge7, t0.verwendung AS verwendung8, t1.neuanlageParty_id AS neuanlageParty_id9, t1.aenderungParty_id AS aenderungParty_id10, t1.dtype FROM welupdm_stammdaten_klasse t0 INNER JOIN welupdm_stammdaten_abstractstammdatum t1 ON t0.flow3_persistence_identifier = t1.flow3_persistence_identifier WHERE t1.flow3_persistence_identifier = ? [logged in F3\FLOW3\Persistence\Doctrine\Logging\SqlLogger_Original::startQuery()]
    params => array (
       0 => 7904495e-b9e7-4ea6-aec2-6ba267a845e8
    )
    types => array (
       0 => 2
    )

#2

Updated by Karsten Dambekalns about 10 years ago

  • Category set to Persistence
  • Status changed from New to Needs Feedback
  • Priority changed from Should have to Must have
  • Target version set to 1230

Can you show me the code that does the remove? Specifically, where does the object come from that is given to remove?

It seems it is a clone, thus detached and therefore not removable. When fetching it, it's not detached, thus the removal works.

#3

Updated by Regine Rosewich about 10 years ago

Hi Karsten,

I almost forgot that error. But it is exactly as you wrote. The object is a cloned one. Thus it's o.k. that the removal has to be done by first querying the database and then removing the object.

You can put the Bug to 'solved'.

Thanx.

#4

Updated by Sebastian Kurfuerst almost 10 years ago

  • Status changed from Needs Feedback to Rejected
#5

Updated by Karsten Dambekalns almost 10 years ago

  • Target version changed from 1230 to 1.0.0
#6

Updated by Regine Rosewich almost 10 years ago

Hi Karsten,

as the error was caused by a misunderstanding of FLOW3 by myself and I soon afterwards got the trick, I entirely forgot this bug-report.

The bug-report is therefore outdated. Just throw it away. Sorry for the inconvenience.

Regine

Also available in: Atom PDF