@@ -214,12 +214,15 @@ Optional parameters:
214214 - ``check ``: Adds a check constraint type to the column (might not
215215 be supported by all vendors).
216216
217- - **columnDefinition **: DDL SQL snippet that starts after the column
217+ - **columnDefinition **: Specify the DDL SQL snippet that starts after the column
218218 name and specifies the complete (non-portable!) column definition.
219219 This attribute allows to make use of advanced RMDBS features.
220- However you should make careful use of this feature and the
221- consequences. ``SchemaTool `` will not detect changes on the column correctly
222- anymore if you use ``columnDefinition ``.
220+ However, as this needs to be specified in the DDL native to the database,
221+ the resulting schema changes are no longer portable. If you specify a
222+ ``columnDefinition ``, the ``SchemaTool `` ignores all other attributes
223+ that are normally used to build the definition DDL. Changes to the
224+ ``columnDefinition `` are not detected, you will need to manually create a
225+ migration to apply changes.
223226
224227 Additionally you should remember that the ``type ``
225228 attribute still handles the conversion between PHP and Database
@@ -262,10 +265,11 @@ Examples:
262265 )]
263266 protected $loginCount;
264267
265- // MySQL example: full_name char(41) GENERATED ALWAYS AS (concat(firstname,' ',lastname)),
268+ // columnDefinition is raw SQL, not DQL. This example works for MySQL:
266269 #[Column(
267270 type: "string",
268271 name: "user_fullname",
272+ columnDefinition: "VARCHAR(255) GENERATED ALWAYS AS (concat(firstname,' ',lastname))",
269273 insertable: false,
270274 updatable: false
271275 )]
@@ -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
@@ -677,8 +681,10 @@ Optional parameters:
677681- **onDelete **: Cascade Action (Database-level)
678682- **columnDefinition **: DDL SQL snippet that starts after the column
679683 name and specifies the complete (non-portable!) column definition.
680- This attribute enables the use of advanced RMDBS features. Using
681- this attribute on ``#[JoinColumn] `` is necessary if you need slightly
684+ This attribute enables the use of advanced RMDBS features. Note that you
685+ need to reference columns by their database name (either explicitly set in
686+ the mapping or per the current :doc: `naming strategy <namingstrategy >`).
687+ Using this attribute on ``#[JoinColumn] `` is necessary if you need
682688 different column definitions for joining columns, for example
683689 regarding NULL/NOT NULL defaults. However by default a
684690 "columnDefinition" attribute on :ref: `#[Column] <attrref_column >` also sets
0 commit comments