0

I try to sort my query directly with annotations as it is done by ORM with MongoDB.

/**
 * @ORM\OrderBy({"position" = "ASC"})
 */

I use a @MongoDB\ReferenceMany:

class page{
  /**
   * @MongoDB\ReferenceMany(
   *     targetDocument="Project\PageBundle\Document\Contenu",
   *     cascade="all",
   *     sort={"position"="ASC"}
   * )
   */
  $protected contenus;
  public function getContenus(){
      return $this->contenus;
  }
}

When I make a $page->getContenus(); call the MongoDB query is working but the listing is not sorted. I cleared the cache but it doesn't help.

What can I do?

Florent
  • 12,310
  • 10
  • 49
  • 58
vinzcoco
  • 89
  • 1
  • 9

1 Answers1

0

Thanks Jamie Sutherland it's work. I should to add mappedBy.

vinzcoco
  • 89
  • 1
  • 9