Skip to content
Open
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
10 changes: 6 additions & 4 deletions Neos.Flow/Classes/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ public function boot(Core\Bootstrap $bootstrap)
$dispatcher = $bootstrap->getSignalSlotDispatcher();

$dispatcher->connect(Mvc\Dispatcher::class, 'afterControllerInvocation', function ($request) use ($bootstrap) {
// No auto-persistence if there is no PersistenceManager registered
// No auto-persistence if there is no PersistenceManager loaded
// This signal will not be fired at compile time, as it's only emitted for web requests which happen at runtime.
if (
$bootstrap->getObjectManager()->has(Persistence\PersistenceManagerInterface::class)
/** @phpstan-ignore-next-line the object manager interface doesn't specify this method */
$bootstrap->getObjectManager()->hasInstance(Persistence\PersistenceManagerInterface::class)
) {
if (SecurityHelper::hasSafeMethod($request->getHttpRequest()) !== true) {
$bootstrap->getObjectManager()->get(Persistence\PersistenceManagerInterface::class)->persistAll();
Expand All @@ -86,9 +87,10 @@ public function boot(Core\Bootstrap $bootstrap)
});

$dispatcher->connect(Cli\Dispatcher::class, 'afterControllerInvocation', function () use ($bootstrap) {
// No auto-persistence if there is no PersistenceManager registered or during compile time
// No auto-persistence if there is no PersistenceManager loaded or during compile time
if (
$bootstrap->getObjectManager()->has(Persistence\PersistenceManagerInterface::class)
/** @phpstan-ignore-next-line the object manager interface doesn't specify this method */
$bootstrap->getObjectManager()->hasInstance(Persistence\PersistenceManagerInterface::class)
&& !($bootstrap->getObjectManager() instanceof CompileTimeObjectManager)
) {
$bootstrap->getObjectManager()->get(Persistence\PersistenceManagerInterface::class)->persistAll();
Expand Down