Note about upgrading: Doctrine uses static and runtime mechanisms to raise awareness about deprecated code. - Use of `@deprecated` docblock that is detected by IDEs (like PHPStorm) or Static Analysis tools (like Psalm, phpstan) - Use of our low-overhead runtime deprecation API, details: https://github.com/doctrine/deprecations/ # Upgrade to 3.x General Notes We recommend you upgrade to DBAL 3 first before upgrading to ORM 3. See the DBAL upgrade docs: https://github.com/doctrine/dbal/blob/3.10.x/UPGRADE.md Rather than doing several major upgrades at once, we recommend you do the following: - upgrade to DBAL 3 - deploy and monitor - upgrade to ORM 3 - deploy and monitor - upgrade to DBAL 4 - deploy and monitor If you are using Symfony, the recommended minimal Doctrine Bundle version is 2.15 to run with ORM 3. At this point, we recommend upgrading to PHP 8.4 first and then directly from ORM 2.19 to 3.5 and up so that you can skip the lazy ghost proxy generation and directly start using native lazy objects. # Upgrade to 3.6 ## Deprecate using string expression for default values in mappings Using a string expression for default values in field mappings is deprecated. Use `Doctrine\DBAL\Schema\DefaultExpression` instances instead. Here is how to address this deprecation when mapping entities using PHP attributes: ```diff use DateTime; +use Doctrine\DBAL\Schema\DefaultExpression\CurrentDate; +use Doctrine\DBAL\Schema\DefaultExpression\CurrentTime; +use Doctrine\DBAL\Schema\DefaultExpression\CurrentTimestamp; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] final class TimeEntity { #[ORM\Id] #[ORM\Column] public int $id; - #[ORM\Column(options: ['default' => 'CURRENT_TIMESTAMP'], insertable: false, updatable: false)] + #[ORM\Column(options: ['default' => new CurrentTimestamp()], insertable: false, updatable: false)] public DateTime $createdAt; - #[ORM\Column(options: ['default' => 'CURRENT_TIME'], insertable: false, updatable: false)] + #[ORM\Column(options: ['default' => new CurrentTime()], insertable: false, updatable: false)] public DateTime $createdTime; - #[ORM\Column(options: ['default' => 'CURRENT_DATE'], insertable: false, updatable: false)] + #[ORM\Column(options: ['default' => new CurrentDate()], insertable: false, updatable: false)] public DateTime $createdDate; } ``` Here is how to do the same when mapping entities using XML: ```diff - +