将长注释字符串拆分为docblock中的多行

时间:2014-05-02 23:30:33

标签: php doctrine-orm annotations

我在注释块中有一个长字符串,就像这个一样(参见query属性):

/**
 * @Table(name="messages")
 * @Entity
 * @NamedNativeQueries({
 *    @NamedNativeQuery(
 *      name = "searchMessages",
 *      resultClass= "__CLASS__",
 *      query = "SELECT * FROM message WHERE id IN (SELECT post_id FROM (SELECT m.post_id, COUNT(*) AS words FROM phpbb_search_wordmatch m INNER JOIN phpbb_search_wordlist w ON w.id = m.word_id WHERE blah blah blah blah ...."
 *    )
 * })
 */
class Message {
...

我希望将其划分为多行,以便更具可读性。

是否可以在多行中断查询字符串?

1 个答案:

答案 0 :(得分:8)

我自己就找到了它:

/**
 * @Table(name="messages")
 * @Entity
 * @NamedNativeQueries({
 *    @NamedNativeQuery(
 *      name = "searchMessages",
 *      resultClass= "__CLASS__",
 *      query = "SELECT * FROM message WHERE id IN (
          SELECT post_id FROM (
             SELECT m.post_id, COUNT(*) AS words 
             FROM phpbb_search_wordmatch m 
             INNER JOIN phpbb_search_wordlist w ON w.id = m.word_id 
             WHERE blah blah blah blah ...."
 *    )
 * })
 */
class Message {
...

这可以按预期工作。