/** * Adds a condition to a the query where the supplied object should exist in the associated * collection represented by a field. * * ##Example: * * {{{ * $kris = new Person('Kris'); * $jon = new Person('Jon'); * $kris->save(); * $jon->save(); * // ... after flush ... * $jon->bestFriend = $kris; * $qb = $person->getDataSource()->createQueryBuilder('Person'); * $qb->field('bestFriend')->references($kris); * * // You should expect this * $jon === $qb->getSingleResult(); * }}} * * @param object $document instance of any document to be used as reference for the collection * @return QueryProxy this instance */ public function references($document) { $this->queryChanged = true; return parent::references($document); }