setVersion() public method

Enables version on the query.
public setVersion ( boolean $version = true )
$version boolean OPTIONAL Enabled or disable version (default = true)
Exemplo n.º 1
0
 public function findOneBy(ClassMetadata $class, $field, $value)
 {
     $filter = new Term(array($field => $value));
     $query = new Query(new Filtered(null, $filter));
     $query->setVersion(true);
     $query->setSize(1);
     $results = $this->search($query, array($class));
     if (!$results->count()) {
         throw new NoResultException();
     }
     return $results[0];
 }