Skip to content

Commit

Permalink
WIP: SF5 Compatibility, Drop FOS USER
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed Sep 27, 2023
1 parent 18bede3 commit 76ee6f5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
9 changes: 5 additions & 4 deletions src/Controller/DebugController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Controller;
namespace BadPixxel\BrevoBridge\Controller;

use BadPixxel\SendinblueBridge\Interfaces\MjmlTemplateProviderInterface;
use BadPixxel\SendinblueBridge\Models\AbstractEmail;
use BadPixxel\SendinblueBridge\Services\TemplateManager as Manager;
use BadPixxel\BrevoBridge\Interfaces\MjmlTemplateProviderInterface;
use BadPixxel\BrevoBridge\Models\AbstractEmail;
use BadPixxel\BrevoBridge\Services\TemplateManager as Manager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface;
Expand Down Expand Up @@ -146,6 +146,7 @@ public function emailAction(
/** @var FilesystemLoader $loader */
$loader = $twig->getLoader();
$loader->addPath($tmplPath);

//==============================================================================
// Render Email Html Preview
return $this->render(
Expand Down
9 changes: 6 additions & 3 deletions src/Controller/EmailAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Controller;
namespace BadPixxel\BrevoBridge\Controller;

use BadPixxel\BrevoBridge\Entity\AbstractEmailStorage as Email;
use BadPixxel\BrevoBridge\Services\SmtpManager;
use BadPixxel\Paddock\System\MySql\Controller\GdprAdminActionsTrait;
use BadPixxel\SendinblueBridge\Entity\AbstractEmailStorage as Email;
use BadPixxel\SendinblueBridge\Services\SmtpManager;
use Exception;
use Sonata\AdminBundle\Controller\CRUDController;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
Expand Down Expand Up @@ -49,6 +49,7 @@ public function previewAction(int $id = null): Response
if (null == $email) {
throw $this->createNotFoundException(sprintf('unable to find the object with id: %s', $id));
}

//====================================================================//
// Output the raw Email Contents
return new Response($email->getHtmlContent());
Expand Down Expand Up @@ -84,6 +85,7 @@ public function refreshAction(Request $request, SmtpManager $smtpManager, int $i
if ($referer) {
return $this->redirect($referer);
}

//====================================================================//
// Redirect to View Page
return $this->redirect(
Expand All @@ -108,6 +110,7 @@ public function batchActionRefresh(ProxyQueryInterface $selectedModelQuery): Red
//==============================================================================
// Load Selected Models
$selectedModels = $selectedModelQuery->execute();

//==============================================================================
// Refresh Email (Forced)
try {
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/SmsAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Controller;
namespace BadPixxel\BrevoBridge\Controller;

use BadPixxel\Paddock\System\MySql\Controller\GdprAdminActionsTrait;
use Sonata\AdminBundle\Controller\CRUDController;
Expand Down
14 changes: 7 additions & 7 deletions src/Controller/TemplatesAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Controller;
namespace BadPixxel\BrevoBridge\Controller;

use BadPixxel\SendinblueBridge\Models\AbstractEmail;
use BadPixxel\SendinblueBridge\Services\SmtpManager;
use BadPixxel\SendinblueBridge\Services\TemplateManager;
use BadPixxel\BrevoBridge\Models\AbstractEmail;
use BadPixxel\BrevoBridge\Services\SmtpManager;
use BadPixxel\BrevoBridge\Services\TemplateManager;
use Sonata\AdminBundle\Controller\CRUDController as Controller;
use Sonata\UserBundle\Model\UserInterface as User;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -75,7 +75,7 @@ public function listAction(Request $request): Response
}
}

return $this->renderWithExtraParams("@SendinblueBridge/TemplatesAdmin/list.html.twig", array(
return $this->renderWithExtraParams("@BrevoBridge/TemplatesAdmin/list.html.twig", array(
"tmplEmails" => $tmplEmails,
"allEmails" => $this->tmplManager->getAllEmails(),
));
Expand Down Expand Up @@ -125,7 +125,7 @@ public function viewAction(KernelInterface $kernel, Environment $twig, string $e
/** @var UserInterface $user */
$user = $this->getUser();

return $this->render("@SendinblueBridge/Debug/email_view.html.twig", array(
return $this->render("@BrevoBridge/Debug/email_view.html.twig", array(
"tmplPath" => self::TMPL_PATH,
'tmplParams' => $this->tmplManager->getTmplParameters($emailClass, $user),
"tmplEmails" => $tmplEmails,
Expand Down Expand Up @@ -245,6 +245,6 @@ public function sendAction(Request $request, SmtpManager $smtpManager, string $e
*/
private function redirectToIndex(): Response
{
return $this->redirectToRoute("admin_badpixxel_sendinblue_templates_list");
return $this->redirectToRoute("admin_badpixxel_brevo_templates_list");
}
}
5 changes: 3 additions & 2 deletions src/Controller/WebHooksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Controller;
namespace BadPixxel\BrevoBridge\Controller;

use BadPixxel\SendinblueBridge\Services\SmtpManager;
use BadPixxel\BrevoBridge\Services\SmtpManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -83,6 +83,7 @@ private function verify(Request $request) : string
if (empty($messageId) || !is_scalar($messageId)) {
throw new BadRequestHttpException('No Message Id Found');
}

//====================================================================//
// Return Message Id
return (string) $messageId;
Expand Down

0 comments on commit 76ee6f5

Please sign in to comment.