Victor Bocharsky
Victor Bocharsky

Reputation: 12306

How to add comment for table in yaml mapping format with Doctrine2

I need to add comment for whole table, not only for column, How can I do it with yml mapping format. I try next definition:

Acme\DemoBundle\Entity\User:
    type: entity
    table: users
    comment: 'Users table'
    options:
        comment: 'Users table'

But it not work for table comment.

Upvotes: 2

Views: 1628

Answers (2)

Nicolas
Nicolas

Reputation: 1474

You have to include the coments section within the options section at the table label. Given example:

Acme\DemoBundle\Entity\User:
    type: entity
    table: users
    options:
        comment: 'Table comment'
    fields:
        field1:
            type: field_type
            nullable: [true|false]
            options:
                comment: 'Field comment'
            column: table_column

Be careful with indentations.

Tested with Symfony 2.6.6, Doctrine 2.5.4

Upvotes: 2

Pradeep
Pradeep

Reputation: 2507

According to the annotations reference, it says only the column has an options attribute for comments. And that too is vendor specific. You need to check if your db supports it.

Check: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/annotations-reference.html#annref-column

Upvotes: 1

Related Questions