Skip to content

Instantly share code, notes, and snippets.

@nebkam
Created June 21, 2021 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nebkam/98c4109e71106400bd57597c0810c1ef to your computer and use it in GitHub Desktop.
Save nebkam/98c4109e71106400bd57597c0810c1ef to your computer and use it in GitHub Desktop.
Use_documentClass_to_fetch_appropriate_repo.patch
Index: src/Repository/AdRepository.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Repository/AdRepository.php b/src/Repository/AdRepository.php
--- a/src/Repository/AdRepository.php (revision c3b6a02259a16176761149ddf9781cd0686e8941)
+++ b/src/Repository/AdRepository.php (date 1624288342730)
@@ -76,9 +76,7 @@
if ($savedSearch->getFilter())
{
$savedSearch->getFilter()->parseSearchParam($builder, $annotationReader);
-
- $builder->field('type')->equals($savedSearch->getFilter()->getType());
-
+
if ($placeIds = $savedSearch->getFilter()->getPlaceIds())
{
$builder
Index: src/Command/Users/SavedSearchEmailAlertCommand.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Command/Users/SavedSearchEmailAlertCommand.php b/src/Command/Users/SavedSearchEmailAlertCommand.php
--- a/src/Command/Users/SavedSearchEmailAlertCommand.php (revision c3b6a02259a16176761149ddf9781cd0686e8941)
+++ b/src/Command/Users/SavedSearchEmailAlertCommand.php (date 1624288304410)
@@ -87,11 +87,14 @@
private function fetchSavedSearchesAndCountNewAds(OutputInterface $output): void
{
$this->stopwatch->start('searches');
+ /** @var SavedSearch $savedSearch */
foreach ($this->dm->getRepository(SavedSearch::class)->getAllBySavedBy($this->userIds()) as $savedSearch)
{
try
{
- $newAdCount = $this->dm->getRepository(Ad::class)->countNewAdsInSavedSearch($savedSearch, $this->annotationReader);
+ $filter = $savedSearch->getFilter();
+ $documentClass = $filter::$documentClass;
+ $newAdCount = $this->dm->getRepository($documentClass)->countNewAdsInSavedSearch($savedSearch, $this->annotationReader);
if ($newAdCount > 0)
{
$this->addSavedSearchToIndex($savedSearch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment