0

How should I name a Doctrine 2 Model table row variable (e.g. url-name is the table row name) and I tried it with that:

/** @Column(name="url-name", type="string") */
private $urlName;

// or I tried also

/** @Column(name="`url-name`", type="string") */
private $url_name;

But it doesn't fetch the $urlName row (this row result is empty but other rows/the rest is fetched correct).

4

1 回答 1

0

您不能使用减号作为列名的一部分。看看这个查询:

SELECT url-name ...

这意味着从 url 中减去名称,就像price * tax将价格乘以税一样。使用_而不是-.

于 2010-11-28T22:39:56.493 回答