[DDC-2069] Spaces are not ignored in the "column" list of a uniqueConstraints Created: 12/Oct/12  Updated: 09/Nov/12  Resolved: 21/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.3
Fix Version/s: 2.3.1
Security Level: All

Type: Bug Priority: Minor
Reporter: Matthieu Napoli Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: yaml


 Description   

In a YAML configuration file

Behavior correct for this:

  uniqueConstraints:
    myConstraint:
      columns: column1,column2

However, if I add a space in the "columns" list:

  uniqueConstraints:
    myConstraint:
      columns: column1, column2

I end up with the following exception:

exception 'Doctrine\DBAL\Schema\SchemaException' with message 'There is no column with name ' column2' on table 'myTable'.

This can be very confusing, especially if (by any chance) you have a line return just on the space in the command line: you never see the space in the exception message.

It seems that YAML allows spaces in lists (http://en.wikipedia.org/wiki/YAML#Lists), but this line doesn't seem to be a YAML list. If it is parsed by Doctrine (split on ","), spaces should be ignored (or trimmed).



 Comments   
Comment by Matthieu Napoli [ 17/Oct/12 ]

Note that using the correct YAML format works:

uniqueConstraints:
    myConstraint:
      columns: [column1, column2]

So it's confusing to have 2 possibilities to write the same thing, and that they don't behave the same.

Comment by Fabio B. Silva [ 21/Oct/12 ]

Fixed by : https://github.com/doctrine/doctrine2/commit/814f2f9e039caf712b75af7f61d28c361189bcab

Generated at Mon Dec 22 22:04:37 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.