Skip to content
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

[RFC] purge on kernel terminate, instead of post flush #1286

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function onFlush(OnFlushEventArgs $eventArgs)
/**
* Purges tags collected during this request, and clears the tag list.
*/
public function postFlush()
public function onKernelTerminate()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do that you are not in the right place. This is in the doctrine bridge

Copy link
Contributor Author

@bendavies bendavies Jul 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed good point. there would be a better place if the change is thought to be good.

{
$this->purger->purge($this->tags);
$this->tags = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<tag name="doctrine.event_listener" event="preUpdate" />
<tag name="doctrine.event_listener" event="onFlush" />
<tag name="doctrine.event_listener" event="postFlush" />
<tag name="kernel.event_listener" event="kernel.terminate" method="onKernelTerminate" />
</service>

</services>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testOnFlush()

$listener = new PurgeHttpCacheListener($purgerProphecy->reveal(), $iriConverterProphecy->reveal(), $resourceClassResolverProphecy->reveal());
$listener->onFlush($eventArgs);
$listener->postFlush();
$listener->onKernelTerminate();
}

public function testPreUpdate()
Expand Down Expand Up @@ -108,6 +108,6 @@ public function testPreUpdate()

$listener = new PurgeHttpCacheListener($purgerProphecy->reveal(), $iriConverterProphecy->reveal(), $resourceClassResolverProphecy->reveal());
$listener->preUpdate($eventArgs);
$listener->postFlush();
$listener->onKernelTerminate();
}
}