Details
Description
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;
}
Activity
Laurens Coudeville
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Summary | When tablename or field name contains an '-' it gets a mysql error | When tablename or field name contains an hyphen it generates an error |
Fabio B. Silva
made changes -
| Assignee | Benjamin Eberlei [ beberlei ] | Fabio B. Silva [ fabio.bat.silva ] |
Fabio B. Silva
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.3 [ 10185 ] | |
| Resolution | Fixed [ 1 ] |
Benjamin Eberlei
made changes -
| Workflow | jira [ 13546 ] | jira-feedback [ 15285 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback [ 15285 ] | jira-feedback2 [ 17149 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback2 [ 17149 ] | jira-feedback3 [ 19403 ] |
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1719, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
Fixed by : https://github.com/doctrine/doctrine2/commit/cb72219b118c158c9b5344c4b81ff2b1a9149ab0