Aufgrund von Doktrin -Proxys kann es nicht readonly -Klasse verwendet werden
Posted: 22 May 2025, 12:03
Q
A
Version doctrine/orm
3.3.2
< /tr>
Version PHP < /td>
8.2
< /tr>
< /tbody>
< /tabel> < /div>
Wie man in der Symfony -Umgebung [/h4]
reproduziert Es ist möglich, eine Konfiguration (in Dev) zu definieren, um die Proxyklasse automatisch zu generieren. Reproduzieren Sie das Problem Easyli Erstellen Sie eine Klasse wie: < /p>
A
Version doctrine/orm
3.3.2
< /tr>
Version PHP < /td>
8.2
< /tr>
< /tbody>
< /tabel> < /div>
Code: Select all
Compile Error: Non-readonly class Proxies\__CG__\App\Entity\FilteringQuestion cannot extend readonly class App\Entity\FilteringQuestion
< /code>
Erzeugter Proxy ist wie: < /p>
namespace Proxies\__CG__\App\Entity;
/**
* DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR
*/
class FilteringQuestion extends \App\Entity\FilteringQuestion implements \Doctrine\ORM\Proxy\InternalProxy
{
...
< /code>
[h4] Erwartete Verhalten < /h4>
No Fehler ✔ < /p>
Erzeugter Proxy ist wie: < /p>
namespace Proxies\__CG__\App\Entity;
/**
* DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR
*/
readonly class FilteringQuestion extends \App\Entity\FilteringQuestion implements \Doctrine\ORM\Proxy\InternalProxy
{
...
reproduziert Es ist möglich, eine Konfiguration (in Dev) zu definieren, um die Proxyklasse automatisch zu generieren. Reproduzieren Sie das Problem Easyli Erstellen Sie eine Klasse wie: < /p>
Code: Select all
#[ORM\Entity()]
readonly class FilteringQuestion {...}
< /code>
Der generierte Proxy ist < /p>
class FilteringQuestion extends \App\Entity\FilteringQuestion implements \Doctrine\ORM\Proxy\InternalProxy {...}