-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
113 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace app\models\backgroundJobs; | ||
|
||
use app\components\mail\Base; | ||
use app\components\RequestContext; | ||
use app\models\db\Consultation; | ||
use app\models\db\EMailLog; | ||
use app\models\exceptions\MailNotSent; | ||
use app\models\settings\AntragsgruenApp; | ||
use app\views\consultation\LayoutHelper; | ||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface; | ||
|
||
class BuildStaticCache extends IBackgroundJob | ||
{ | ||
public const TYPE_ID = 'BUILD_STATIC_CACHE'; | ||
|
||
public const CACHE_ID_CONSULTATION_HOME = 'CONSULTATION_HOME'; | ||
|
||
private ?string $result = null; | ||
|
||
public function __construct( | ||
public string $cacheId, | ||
?Consultation $consultation, | ||
public bool $adminMode | ||
) { | ||
$this->consultation = $consultation; | ||
} | ||
|
||
public function getTypeId(): string | ||
{ | ||
return self::TYPE_ID; | ||
} | ||
|
||
public function execute(): void | ||
{ | ||
$this->result = match ($this->cacheId) { | ||
self::CACHE_ID_CONSULTATION_HOME => $this->getConsultationHome(), | ||
default => null, | ||
}; | ||
} | ||
|
||
public function getResult(): ?string | ||
{ | ||
return $this->result; | ||
} | ||
|
||
private function getConsultationHome(): string | ||
{ | ||
return LayoutHelper::renderHomePageList($this->consultation, $this->adminMode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters