문제

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).

도움이 되었습니까?

해결책

You cannot use minus character as a part of column name. Just take a look at this query:

SELECT url-name ...

It means substract name from url just like price * tax means multiply price by tax. Use _ instead of -.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top