This documentation is for a version that has reached its End Of Life. Such versions are no longer supported and don't receive security updates. Consider updating to a newer version.
ParentLocationId Criterion¶
The ParentLocationId Search Criterion
searches for content based on the Location ID of its parent.
Arguments¶
value- int(s) representing the parent location IDs
Example¶
PHP¶
1 | |
REST API¶
1 2 3 4 5 | |
1 2 3 4 5 | |
Use case¶
You can use the ParentLocationId Search Criterion to list blog posts contained in a blog:
``` php {skip-validation} hl_lines="4" $query = new LocationQuery(); query->query = new Criterion\LogicalAnd([ new Criterion\Visibility(Criterion\Visibility::VISIBLE), new Criterion\ParentLocationId(locationId), ]);
$results = this->searchService->findLocations(query); posts = []; foreach (results->searchHits as $searchHit) { $posts[] = $searchHit; }
return $this->render('full/blog.html.twig', [ 'posts' => $posts, ]);
1 2 3 4 5 6 7 | |