floriansemm / SolrBundle

Solr-Integration into Symfony and Doctrine2
http://floriansemm.github.io/SolrBundle
MIT License
123 stars 72 forks source link

QueryException 'id should not be null' #165

Closed revlis7 closed 7 years ago

revlis7 commented 7 years ago

Parameter $id is not used in find function, and a QueryException will be thrown here.

https://github.com/floriansemm/SolrBundle/blob/master/Repository/Repository.php#L52

public function find($id)
{
    $query = new FindByIdentifierQuery();
    $query->setIndex($this->metaInformation->getIndex());
    $query->setDocumentKey($this->metaInformation->getDocumentKey()); // maybe use $id instead
    $query->setEntity($this->metaInformation->getEntity());
    $query->setSolr($this->solr);
    $query->setHydrationMode($this->hydrationMode);
    $found = $this->solr->query($query);
    if (count($found) == 0) {
        return null;
    }
    return array_pop($found);
}
floriansemm commented 7 years ago

should be fixed. How does the exception look like?

revlis7 commented 7 years ago

QueryException is just the same issue. Now it's okay.