Skip to content

DDC-1278 - EntityManager::clear($entity) support #104

Closed
wants to merge 2 commits into from

3 participants

@domnikl
domnikl commented Aug 12, 2011

added new parameter $entityName for UnitOfWork::clear()
removed not implemented exception in EntityManager:clear()
clear entities of the specified class iterating over identityMap and calling doDetach()

Dominik Liebler added some commits Aug 11, 2011
Dominik Liebler DDC-1278 - EntityManager::clear($entity) support
added new parameter $entityName for UnitOfWork::clear()
removed not implemented exception in EntityManager:clear()
05fb0b9
Dominik Liebler fixed typo 745535d
@beberlei
Doctrine member

There are several things missing from this test:

  1. onClear has to be fired anyways
  2. There are no tests
  3. Not sure if detach is the right way here, since you can cascade that, but it sure seems like a good start. But we need to limit the cascading to really only entity-name entities.
@beberlei
Doctrine member

Oh and you should open a ticket on doctrine-project.org/jira - otherwise this slips under my radar.

@domnikl
domnikl commented Aug 13, 2011

Ok now I see why this isn't implemented yet, seems more complicated than I thought it is ;-)
There is already a ticket http://www.doctrine-project.org/jira/browse/DDC-1278 for this, I'll write a comment there.

@domnikl domnikl closed this Aug 13, 2011
@guilhermeblanco
Doctrine member

I think cascading is fine, mainly because Entity dependencies must also be cleared/detached. =)

@domnikl
domnikl commented Aug 13, 2011

I added cascade detach to only detach entities with the same class. I am still unsure where to add my tests for this. Is \Doctrine\Tests\ORM\Functional\BasicFunctionalTest the right place for this? Haven't found any code that explicitly tests the clear() Method

@domnikl domnikl reopened this Aug 13, 2011
@domnikl
domnikl commented Aug 13, 2011

Sorry for the mess, seems like github doesn't add my new commit after I closed this and reopened after the commit, I'll create a new PR for this and close this one ...

@domnikl domnikl closed this Aug 13, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.