我已经在Symfony2框架中实现了注释为由Doctrine使用的实体。例如:
/*
* class description
*
* @ORM\Entity(repositoryClass="Website\ContentBundle\Repository\ContentRepository")
* @ORM\HasLifecycleCallbacks()
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({"article" = "Article"})
* @ORM\Table(name="content",indexes={@ORM\index(name="id_UNIQUE",columns={"id"})})
*/
class Content {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
...
}
当我在源代码上运行Doxygen时,文档的可读性不高。我试图为每个@ ORM *符号定义别名;例如“ORM = ORM”,“Entity = Entity”,依此类推。但这不起作用。对于上面提到的类Doxygen返回
...
ORMEntity(repositoryClass="Website\ContentBundle\Repository\ContentRepository") ORM() ORM("SINGLE_TABLE") ORM(name="type", type="string") ORM({"article" = "Article", "picture_series" = "PictureSeries", "event" = "Event", "invitation" = "Invitation"}) ORMTable(name="content",indexes={ORM(name="id_UNIQUE",columns={"id"})})
关于方法
/**
* sets the given id
*
* @param number $id
* @return \Website\ContentBundle\Entity\Content
*/
public function setId($id) {
$this->id = $id;
return $this; // fluent interface
}
Doxygen创造
setId ($ id)
sets the given id
Parameters:
number $id
Returns:
为什么在“返回:”后没有显示\ Website \ ContentBundle \ Entity \ Content?
也许有人可以给我一个关于如何配置Doxygen的提示或链接,以便它可以适当地处理@ORM注释。
提前THX!答案 0 :(得分:1)
关于问题
为什么在
\Website\ContentBundle\Entity\Content
之后没有显示Returns:
?
这可能是因为doxygen命令以\
开头,doxygen认为你正在调用一些它无法识别的命令,因此可能会从文档中删除并且不执行任何操作。
您在尝试使用ALIASES
配置文件选项时处于正确的位置。但是,不要使用ORM=ORM
定义ORM=\@ORM
。通过定义以下别名,我得到了doxygen记录的示例源代码,没有任何警告:
ALIASES = "ORM=\@ORM"
ALIASES += "Entity=\\Entity"
ALIASES += "InheritanceType=\\InheritanceType"
ALIASES += "DiscriminatorColumn=\\DiscriminatorColumn"
ALIASES += "DiscriminatorMap=\\DiscriminatorMap"
ALIASES += "Table=\\Table"
ALIASES += "Id=\\Id"
ALIASES += "Column=\\Column"
ALIASES += "GeneratedValue=\\GeneratedValue"
ALIASES += "index=\\index"
ALIASES += "HasLifecycleCallbacks=\\HasLifecycleCallbacks"
ALIASES += "Repository=\\Repository"
ALIASES += "ContentRepository=\\ContentRepository"
ALIASES += "ContentBundle=\\ContentBundle"
ALIASES += "Website=\\Website"
ALIASES += "Content=\\Content"
此处\\
,\@
实际上是doxygen命令,分别用于打印反斜杠\
和@
字符。
但请注意,@ORM...
指令将全部出现在同一行。我不确定如何避免这种情况(更新:请参阅下面的编辑)。还有其他人有什么想法吗?
最后,作为旁注,$id
的文档应为
* @param $id number
请注意$id
和number
的顺序。请参阅\param
的文档。
编辑:执行此操作的另一种方法是将Doctrine相关部分包装在\verbatim
和\endverbatim
标记中。这将保留您的类描述中的换行符,这将更易读。