-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[Minor] Refactoring to avoid duplicate code #1233
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3466 We use Jira to track the state of pull requests and the versions they got |
/** | ||
* @var bool | ||
*/ | ||
private $isChanged = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. Calling afterTransactionComplete
multiple times does not work anymore, because you keep the state between calls
Your extracted private method looks weird with the different switches for the types. IMO, you should extract only the common logic (i.e. insert and update) |
@stof, it is updated. |
@@ -121,4 +92,25 @@ public function update($entity) | |||
|
|||
$this->queuedCache['update'][] = $entity; | |||
} | |||
|
|||
private function handleCache($entity, $isChanged) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call it updateCache
It is done @stof :) |
looks good to me (but I'm not a merger on this repo) |
private function updateCache($entity, $isChanged) | ||
{ | ||
$class = $this->class; | ||
$className = ClassUtils::getClass($entity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is actually useless: we can always ask the metadata factory directly instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$class = $class = $this->metadataFactory->getMetadataFor(get_class($entity))
is enough in any case. ClassUtils::getClass()
causes more internal method calls anyway.
@Ocramius |
ab9fb61
to
eb22db0
Compare
Thanks! Merging :-) |
[Minor] Refactoring to avoid duplicate code
Very merry end of the year :)