When studying a similar problem, I came across in this example :
--- User: columns: ... attributes: export: all validate: true
Applying the same principle with the coll_key attribute gives the following:
User: columns: ... attributes: coll_key: username
After assembly, we can verify that the attribute has been accepted:
$this->setAttribute(Doctrine_Core::ATTR_COLL_KEY, 'username');
However, there is one caveat. You must explicitly create the column that you want to use, otherwise Doctrine throws an error during the build process:
User: actAs: Sluggable: ~ columns: ... attributes: coll_key: slug
$ symfony doctrine: build --all --no-confirmation
>> doctrine Dropping "doctrine" database
>> doctrine Creating "dev" environment "doctrine" database
>> doctrine generating model classes
>> file + /tmp/doctrine_schema_60681.yml
...
>> doctrine generating form classes
Couldn't set collection key attribute. No such field 'slug'. To get the above to work, you need to explicitly specify the slug column, although the Sluggable template usually creates it for you automatically:
User: actAs: Sluggable: ~ columns: ... slug: type: string(50) unique: true attributes: coll_key: slug
user212218
source share