mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
wip.. dump() give a correct result, but have error !!
This commit is contained in:
parent
ecf3f541ef
commit
387d3b53c1
@ -227,28 +227,35 @@ class SimilarityPersonSearch extends AbstractSearch
|
||||
|
||||
$qb = $this->em->createQueryBuilder();
|
||||
|
||||
$qb->from('ChillPersonBundle:Person', 'simi');
|
||||
$qb
|
||||
->select('sp')
|
||||
->from('ChillPersonBundle:Person', 'sp');
|
||||
|
||||
if ($terms['_default'] !== '') {
|
||||
$grams = explode(' ', $terms['_default']);
|
||||
|
||||
foreach($grams as $key => $gram) {
|
||||
$qb->andWhere('SIMILARITY(simi.fullnameCanonical, UNACCENT(LOWER(:default_'.$key.')) ) >= 0.15')
|
||||
$qb->andWhere('SIMILARITY(sp.fullnameCanonical, UNACCENT(LOWER(:default_'.$key.')) ) >= 0.15')
|
||||
->setParameter('default_'.$key, '%'.$gram.'%');
|
||||
}
|
||||
|
||||
///
|
||||
//dump($this->personSearch->createQuery($terms)->addSelect('p.id')->getDQL());
|
||||
|
||||
/// Testé avec http://localhost:8001/fr/search?q=matthieu
|
||||
/// personSearch: 1 result
|
||||
/// similaritySearch: 6 results - 1 = 5 results
|
||||
///
|
||||
$subquery = $this->personSearch->createQuery($terms)
|
||||
->addSelect('p.id');
|
||||
|
||||
$qb->andWhere($qb->expr()
|
||||
->notIn(
|
||||
'simi.id',
|
||||
$this->personSearch->createQuery($terms)
|
||||
->select('p.id')
|
||||
->getDQL()
|
||||
'sp.id',
|
||||
$subquery->getDQL()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
dump($subquery->getDQL());
|
||||
dump($subquery->getQuery()->getResult());
|
||||
///
|
||||
}
|
||||
|
||||
@ -256,14 +263,21 @@ class SimilarityPersonSearch extends AbstractSearch
|
||||
$reachableCenters = $this->helper->getReachableCenters($this->user,
|
||||
new Role('CHILL_PERSON_SEE'));
|
||||
$qb->andWhere($qb->expr()
|
||||
->in('simi.center', ':centers'))
|
||||
->in('sp.center', ':centers'))
|
||||
->setParameter('centers', $reachableCenters)
|
||||
;
|
||||
|
||||
$this->_cacheQuery[$cacheKey] = $qb;
|
||||
|
||||
dump($qb->getDQL());
|
||||
dump($qb->getQuery()->getResult()); //////////// <---- le résultat attendu !!
|
||||
|
||||
return clone $qb;
|
||||
|
||||
///
|
||||
/// [Semantical Error] line 0, col 13 near 'p.id) FROM ChillPersonBundle:Person':
|
||||
/// Error: 'p' is used outside the scope of its declaration.
|
||||
///
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user