zenstruck / foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html
MIT License
607 stars 62 forks source link

fix: fix _autoRefresh dynamic creation deprecation #633

Closed vincentchalamon closed 2 weeks ago

vincentchalamon commented 2 weeks ago

Using Symfony 7.1, PHPUnit 11.2 and Foundry 2.0, I got the following error:

1) /shared/httpd/ae-api/vendor/symfony/var-exporter/Internal/LazyObjectRegistry.php:94 Creation of dynamic property AE\Calendar\CalendarPeriod\Infrastructure\Persistence\Entity\CalendarPeriod::$_autoRefresh is deprecated

Triggered by:

  • AE\Tests\Functional\Calendar\CalendarPeriod\CalendarPeriodOccurrenceApiTest::iCanDeleteACalendarPeriodOccurrence /shared/httpd/ae-api/tests/phpunit/Functional/Calendar/CalendarPeriod/CalendarPeriodOccurrenceApiTest.php:166

This is due to IsProxy::_autoRefresh affectation. I don't know exactly why this error occurred, but moving the _autoRefresh dynamic affectation in a dedicated method seems to solve this deprecation.

Reproducer: https://github.com/zenstruck/foundry/actions/runs/9481854069/job/26125482758

vincentchalamon commented 2 weeks ago

Closing as duplicate from https://github.com/zenstruck/foundry/pull/622