学说2,一对多关系OrderBy Annotations

时间:2011-07-27 03:35:49

标签: doctrine-orm

你好我的一对多关系中的注释有这个php命令

 /**
  * TaskCategory
  *
  * @Table(name="task_category")
  * @Entity(repositoryClass="models\Repositories\TaskCategoryRepository")
  */
class TaskCategory
{
 /**
  * @var array $tasks
  *
  * @OneToMany(targetEntity="Task", mappedBy="taskCategory"")
  * @OrderBy({"sort_order" = "ASC"})
  */
  private $tasks;

我收到了这个错误:

Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Syntax Error] Expected Doctrine\Common\Annotations\Lexer::T_CLOSE_PARENTHESIS, got 'order' at position 108

有人有类似问题吗?任何建议将不胜感激。

2 个答案:

答案 0 :(得分:10)

正确的注释是

@OrderBy({"name" = "ASC"})

请参阅:Doctrine 2 manual: Annotations reference

答案 1 :(得分:3)

对不起,我想我知道这是双引号的错误     @OneToMany(targetEntity =“Task”,mappedBy =“taskCategory”“) 应该是     @OneToMany(targetEntity =“Task”,mappedBy =“taskCategory”)

无论如何,谢谢你的答案。

相关问题