In some occasions DBAL generates
DC2Type SQL comments in columns of
the databases schemas that is maintained by Doctrine. These comments
have a functional purpose in DBAL.
These comments are here to help with reverse engineering. Inside the DBAL, the schema manager can leverage them to resolve ambiguities when it comes to determining the correct DBAL type for a given column.
For instance: You are following a Database First approach,
and want to use GUIDs in your application while using a platform that does not have a native type for
By commenting columns that hold GUIDs with
(DC2Type:guid), you can
let the DBAL know it is supposed to use
when dealing with that column.
When using reverse engineering tools, this can be used to generate
For instance, if you use Doctrine ORM, there is a reverse engineering example
to show how to generate a proper mapping.
A table with such a column may have a declaration that looks as follows:
In the past, these comments were also useful to avoid false positives when diffing a schema created with the DBAL API with a schema introspected from the database. Since platform-aware comparison was introduced in 3.2.0, this is no longer the case. They must be kept in order to keep the platform-unaware comparison APIs working though.
It is important to note that these comments are an implementation detail of the DBAL and should not be relied upon by application code. They are removed in DBAL 4.0.