1

I'm building the Symfony entities from the existing database dump, and decided to switch from Datetime objects to Datatime Immutable, which don't have to change anything in database. But in the migration I see that it's adding the default comment, which I want to get rid of

'ALTER TABLE application_settings CHANGE updated_at updated_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)'');

DB is Mysql.

Here's my Datetime Immutable property in the entity:

#[ORM\Column(name: 'updated_at', type: Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $updatedAt = null;

Didn't find anything about this issue in the internet. Is there any way to get rid of this comment?

2
  • 1
    I think doctrine uses comment to store metadata on the field, since datetime_immutable isn't a MySQL type. But I'm not sure that's what you mean by "default comment" Commented Nov 15, 2022 at 18:53
  • 1
    This modification has no impact on the data. It just indicates for Doctrine that the data type is datetime_immutable and allows the library to correctly hydrate it. Commented Nov 16, 2022 at 14:12

1 Answer 1

0

There is an option in /packages/doctrine.yaml (actual for DBAL3. As I know, DBAL4 doesn't generate such comments):

doctrine:
    dbal:
        # ...
        disable_type_comments: true
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.