Ошибки кэша Doctrine ORM после удаления свойства сущностиPhp

Кемеровские программисты php общаются здесь
Ответить
Гость
 Ошибки кэша Doctrine ORM после удаления свойства сущности

Сообщение Гость »


I've removed the column/property id from my Entity and I think there are some caching problems that causes the following errors when trying to access the Entity:

Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in [...]/vendor/doctrine/persistence/src/Persistence/Reflection/TypedNoDefaultReflectionPropertyBase.php:33 Stack trace: #0 .../vendor/doctrine/persistence/src/Persistence/Reflection/TypedNoDefaultReflectionPropertyBase.php(33): ReflectionProperty->isInitialized(Object(Project\Entities\Entity)) #1 .../vendor/doctrine/orm/src/UnitOfWork.php(586): Doctrine\Persistence\Reflection\TypedNoDefaultReflectionProperty->getValue(Object(Project\Entities\Entity)) ... Creation of dynamic property Project\Entities\Entity::$id is deprecated; .../vendor/doctrine/persistence/src/Persistence/Reflection/RuntimeReflectionProperty.php; 60 I've run php config/cli-config.php orm:generate-proxies (successfully generated new proxies), but when tried any from the following to clear cache:
  • php config/cli-config.php orm:clear-cache:query
  • php config/cli-config.php orm:clear-cache:metadata
  • php config/cli-config.php orm:clear-cache:result

I get such error:

In MemcachedAdapter.php line 300: MemcachedAdapter client error: connection failure The 'hotfix' is to change the isDevMode param to true here:

return new EntityManager( DriverManager::getConnection($params), ORMSetup::createAttributeMetadataConfiguration( paths: [__DIR__ . '/../Entities'], isDevMode: true, // :( proxyDir: __DIR__ . '/../../../tmp', ), ); Please help me properly fix these errors. I have no idea what to do/check next.

Running on:
  • PHP 8.2
  • Doctrine ORM 3.1.0
  • Doctrine DBAL 4.0.1
  • Symfony cache 7.0.4

cli-config.php is basically:

ConsoleRunner::run(new SingleManagerProvider($entity_manager)); To clarify:

I've changed this:

#[Id] #[Column(name: 'id', type: Types::INTEGER, updatable: false, options: ['unsigned' => true])] #[GeneratedValue] private int $id; to this:

#[Id] #[OneToOne(targetEntity: Base::class, inversedBy: 'entity')] #[JoinColumn(name: 'id', referencedColumnName: 'id', unique: true)] private Base $base; so technically my DB doesn't need any modifications.


Источник: https://stackoverflow.com/questions/781 ... y-property
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»