@@ -213,12 +213,15 @@ Optional parameters:
213213 - ``check ``: Adds a check constraint type to the column (might not
214214 be supported by all vendors).
215215
216- - **columnDefinition **: DDL SQL snippet that starts after the column
216+ - **columnDefinition **: Specify the DDL SQL snippet that starts after the column
217217 name and specifies the complete (non-portable!) column definition.
218218 This attribute allows to make use of advanced RMDBS features.
219- However you should make careful use of this feature and the
220- consequences. ``SchemaTool `` will not detect changes on the column correctly
221- anymore if you use ``columnDefinition ``.
219+ However, as this needs to be specified in the DDL native to the database,
220+ the resulting schema changes are no longer portable. If you specify a
221+ ``columnDefinition ``, the ``SchemaTool `` ignores all other attributes
222+ that are normally used to build the definition DDL. Changes to the
223+ ``columnDefinition `` are not detected, you will need to manually create a
224+ migration to apply changes.
222225
223226 Additionally you should remember that the ``type ``
224227 attribute still handles the conversion between PHP and Database
@@ -261,10 +264,11 @@ Examples:
261264 )]
262265 protected $loginCount;
263266
264- // MySQL example: full_name char(41) GENERATED ALWAYS AS (concat(firstname,' ',lastname)),
267+ // columnDefinition is raw SQL, not DQL. This example works for MySQL:
265268 #[Column(
266269 type: "string",
267270 name: "user_fullname",
271+ columnDefinition: "VARCHAR(255) GENERATED ALWAYS AS (concat(firstname,' ',lastname))",
268272 insertable: false,
269273 updatable: false
270274 )]
@@ -366,7 +370,7 @@ Optional parameters:
366370
367371- **type **: By default this is string.
368372- **length **: By default this is 255.
369- - **columnDefinition **: By default this is null the definition according to the type will be used. This option allows to override it.
373+ - **columnDefinition **: Allows to override how the column is generated. See the "columnDefinition" attribute on :ref: ` #[Column] < attrref_column >`
370374- **enumType **: By default this is `null `. Allows to map discriminatorColumn value to PHP enum
371375- **options **: See "options" attribute on :ref: `#[Column] <attrref_column >`.
372376
@@ -678,8 +682,10 @@ Optional parameters:
678682- **onDelete **: Cascade Action (Database-level)
679683- **columnDefinition **: DDL SQL snippet that starts after the column
680684 name and specifies the complete (non-portable!) column definition.
681- This attribute enables the use of advanced RMDBS features. Using
682- this attribute on ``#[JoinColumn] `` is necessary if you need slightly
685+ This attribute enables the use of advanced RMDBS features. Note that you
686+ need to reference columns by their database name (either explicitly set in
687+ the mapping or per the current :doc: `naming strategy <namingstrategy >`).
688+ Using this attribute on ``#[JoinColumn] `` is necessary if you need
683689 different column definitions for joining columns, for example
684690 regarding NULL/NOT NULL defaults. However by default a
685691 "columnDefinition" attribute on :ref: `#[Column] <attrref_column >` also sets
0 commit comments