Closed PsmaDev closed 1 year ago
I'm really sorry, but I don't understand your request. Can you elaborate a bit more on…
Openswoole is not dying after each request like php-fpm. So first request $this->insertSql is null and it generated, next request $this->insertSql is not null so it will be same like in 1 request, but script changed table prefix, so new insert is neede.
INSERT INTO prefix1_tablename ... INSERT INTO prefix2_tablename ...
In traditional php this is not problem, each request bootstraping from scratch.
Possible add some check if table name for entity changed, just set it null. Or make this "cache" optional. Now it is not possible to keep it stateless in long term app.
This has nothing to do with openswoole however, changing the table prefix within a request and then using the EntityManager will produce the same problem. It is not supported to change the table prefix after the EntityManager was created.
The listener that you link doesn't even show support for changing the prefix, its created at ctor time and then the listener is passed to EventManager before the EntityManager is created.
`/**
This "if" brtoke down stateles in case of using openswoole.
In case of changing table prefix this check return wrong sql if multiple requests for tables with different prefix: https://www.doctrine-project.org/projects/doctrine-orm/en/2.15/cookbook/sql-table-prefixes.html The easiest fix just remove this 3 lines:
if ($this->insertSql !== null) { return $this->insertSql; }