Commit b2c163c
committed
BUGFIX: Prevent premature connection to database before
For every simple GET request `persistAllowedObjects` is called via the Package.php in flow.
This results in building a db connection, even if there is nothing to do.
So if neither the persistentManger nor the entityManager has been created by the object manager instantiating one and thus the other which leads to "work".
For the check if the `entityManager` `isOpen` we activate the lazy dependency.
Now in this retrieval process - even though doctrines connection is lazy itself - the connection will be made forcefully
see `\Neos\Flow\Persistence\Doctrine\EntityManagerFactory::create` line 120 (https://github.com/neos/flow-development-collection/blob/11e2348125dd8286ff9ccc088e5d187dc9143bf5/Neos.Flow/Classes/Persistence/Doctrine/EntityManagerFactory.php#L120) or https://github.com/neos/flow-development-collection/blob/d93b6b09ca2071c87812a9ef4bc120201c44608a/Neos.Flow/Classes/Persistence/Doctrine/EntityManagerConfiguration.php#L229
This is ironic because if there is no connection - or no entity manager and persistence manager in the first place, the current process cannot have made any changes to the transaction.
Reason for this is that the Package.php has a wrong check which looks for if the PersistenceManager _exists_ as php class at all rather than if we have an active instance loaded.
This is an old regression from: 163e204PersistenceManager::persistAllowedObjects
1 parent c4d1b64 commit b2c163c
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
90 | 91 | | |
91 | | - | |
| 92 | + | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
0 commit comments