Having more time, I researched doctrine (v2.4.x) SchemaTool.php, which generates the generation. It looks like they are using a method:
Table#addUnnamedForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=array())
which speaks for itself. It is marked as deprecated with reference to:
Table#addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=array(), $constraintName = null)
This method has the argument $ constraintName, which is not currently in use. I think the only way is to edit the Schema tool to use the last method passing your own $ constraintName.
The generation of the constraint name is as follows:
protected function _generateIdentifierName($columnNames, $prefix='', $maxSize=30) { $hash = implode("", array_map(function($column) { return dechex(crc32($column)); }, $columnNames)); return substr(strtoupper($prefix . "_" . $hash), 0, $maxSize); }
source share