DDC-1719: When tablename or field name contains an hyphen it generates an error #2368

Closed
doctrinebot opened this Issue Mar 21, 2012 · 2 comments

1 participant

@doctrinebot

Jira issue originally created by user lcoudeville:

In my database I have a table with '-' (hyphen) in the names of the tables and fields. But when mapping using annotations you get a mysql error because it generates a query that is not conform the mysql syntax. When using a hyphen in field or tablename (or others) you have to place it between quotes.

The name of the table can be resolved using quotes in the table name, in code it means:

@Table(name="directory-file") to @Table(name="directory-file"), you can't use this solution with the in the fields because the alias (AS in mysql syntax) also contains a '-' . Which results in a mysql error.

Failing code:

/****

  • @author Laurens
  • @Entity
  • @Table(name="directory-file")
    */
    class Directory_File {

    /*** @Id @Column(name="liddirectory-file",type="bigint") @GeneratedValue * **/
    protected $liddirectory_file;
    }

@doctrinebot

Comment created by @FabioBatSilva:

Fixed by : cb72219

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.3 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment