How to add column descriptions (comments) in Doctrine2

前端 未结 1 849
借酒劲吻你
借酒劲吻你 2020-12-23 19:28

I would like to add a column description (also called a \"comment\") to a column defined by a Doctrine2 entity but can\'t find any information on how to do

相关标签:
1条回答
  • 2020-12-23 19:52

    You can add a comment to a column name or entire table with the "options" argument to the annotation; eg:

    /**
     * @ORM\Column(type="string", options={"comment":"The string to show in the dropdown "})
     */
    

    for a column, or for a table:

    /**
     * @ORM\Entity
     * @ORM\Table(name="application", options={"comment":"Funding applications"});
     */
    

    Note however this will not add comments to an existing table or column, you have to delete the table from the DB and rebuild it. If it's just adding comments, you could rename the table, create the new table, and import data from the original.

    Source: Doctrine documentation

    0 讨论(0)
提交回复
热议问题