|
@@ -5,6 +5,9 @@ namespace Opentalent\OtTemplating\ViewHelpers\Donors;
|
|
|
use FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait;
|
|
use FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait;
|
|
|
use Opentalent\OtTemplating\Domain\Repository\DonorRepository;
|
|
use Opentalent\OtTemplating\Domain\Repository\DonorRepository;
|
|
|
use Opentalent\OtTemplating\Exception\ApiRequestException;
|
|
use Opentalent\OtTemplating\Exception\ApiRequestException;
|
|
|
|
|
+use Psr\Log\LoggerAwareInterface;
|
|
|
|
|
+use Psr\Log\LoggerAwareTrait;
|
|
|
|
|
+use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -20,8 +23,9 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
|
*
|
|
*
|
|
|
* @package Opentalent\OtTemplating\ViewHelpers
|
|
* @package Opentalent\OtTemplating\ViewHelpers
|
|
|
*/
|
|
*/
|
|
|
-class GetAllViewHelper extends AbstractViewHelper {
|
|
|
|
|
|
|
+class GetAllViewHelper extends AbstractViewHelper implements LoggerAwareInterface {
|
|
|
|
|
|
|
|
|
|
+ use LoggerAwareTrait;
|
|
|
use TemplateVariableViewHelperTrait;
|
|
use TemplateVariableViewHelperTrait;
|
|
|
/**
|
|
/**
|
|
|
* >> Required to prevent typo3 to escape the html output
|
|
* >> Required to prevent typo3 to escape the html output
|
|
@@ -71,6 +75,7 @@ class GetAllViewHelper extends AbstractViewHelper {
|
|
|
*/
|
|
*/
|
|
|
public function render()
|
|
public function render()
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
// Get current settings
|
|
// Get current settings
|
|
|
$as = $this->arguments['as'];
|
|
$as = $this->arguments['as'];
|
|
|
$organizationId = $this->arguments['organizationId'];
|
|
$organizationId = $this->arguments['organizationId'];
|
|
@@ -78,10 +83,20 @@ class GetAllViewHelper extends AbstractViewHelper {
|
|
|
|
|
|
|
|
if ($fromParents) {
|
|
if ($fromParents) {
|
|
|
// Get the donors of the parent structures
|
|
// Get the donors of the parent structures
|
|
|
- $donors = $this->donorRepository->findParentsByOrganizationId($organizationId);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ $donors = $this->donorRepository->findParentsByOrganizationId($organizationId);
|
|
|
|
|
+ } catch (ApiRequestException $e) {
|
|
|
|
|
+ $this->logger->error(sprintf('API Error: %s', $e->getMessage()));
|
|
|
|
|
+ $donors = [];
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
// Get donors of the structure
|
|
// Get donors of the structure
|
|
|
- $donors = $this->donorRepository->findByOrganizationId($organizationId);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ $donors = $this->donorRepository->findByOrganizationId($organizationId);
|
|
|
|
|
+ } catch (ApiRequestException $e) {
|
|
|
|
|
+ $this->logger->error(sprintf('API Error: %s', $e->getMessage()));
|
|
|
|
|
+ $donors = [];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$variables = [$as => $donors];
|
|
$variables = [$as => $donors];
|