Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Fix for config validation - parameters were incorrectly prefixed with…
Browse files Browse the repository at this point in the history
… `config`
  • Loading branch information
wggdeveloper authored and fracsi committed May 13, 2021
1 parent bf47281 commit efcd870
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/MailchimpBundle/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

namespace Wgg\MailchimpBundle\Controller;

use function array_filter;
use Exception;
use function is_array;
use function json_decode;
use Pimcore\Bundle\AdminBundle\Controller\AdminController as BaseAdminController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Wgg\MailchimpBundle\ApiClient;
use Wgg\MailchimpBundle\MailchimpConfiguration;

use function array_filter;
use function is_array;
use function json_decode;

class AdminController extends BaseAdminController
{
private MailchimpConfiguration $cookieConfiguration;
Expand Down Expand Up @@ -64,13 +65,13 @@ public function validateSettingsAction(Request $request): JsonResponse
$values = json_decode($request->get('data'), true);

$this->apiClient->setConfig([
'apiKey' => $values['config.api_key'],
'server' => $values['config.server_prefix'],
'apiKey' => $values['api_key'],
'server' => $values['server_prefix'],
]);

try {
$this->apiClient->ping->get();
$listIds = is_array($values['config.list_id']) ? array_filter($values['config.list_id']) : [$values['config.list_id']];
$listIds = is_array($values['list_id']) ? array_filter($values['list_id']) : [$values['list_id']];
foreach ($listIds as $listId) {
$this->apiClient->lists->getList($listId, 'id');
}
Expand Down

0 comments on commit efcd870

Please sign in to comment.