From b8cb0d770a20022bf09c9dbda05e4967a855e411 Mon Sep 17 00:00:00 2001 From: Volha Pivavarchyk Date: Tue, 12 Nov 2024 00:34:00 +0300 Subject: [PATCH] CS fixing --- Command/GenerateSampleDataCommand.php | 17 ++++++++++------- EventListener/ImportSubscriber.php | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Command/GenerateSampleDataCommand.php b/Command/GenerateSampleDataCommand.php index 7dbcdbb0e..e0f27be2f 100644 --- a/Command/GenerateSampleDataCommand.php +++ b/Command/GenerateSampleDataCommand.php @@ -5,7 +5,7 @@ namespace MauticPlugin\CustomObjectsBundle\Command; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Exception; use Doctrine\ORM\EntityManager; use MauticPlugin\CustomObjectsBundle\Helper\RandomHelper; use Symfony\Component\Console\Command\Command; @@ -111,8 +111,6 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @return int[] - * - * @throws DBALException */ private function createCustomObjectsWithItems(): array { @@ -150,13 +148,16 @@ private function createCustomObjectsWithItems(): array return [$coProductId, $cfPriceId, $coOrderId]; } + /** + * @throws Exception + */ private function cleanupDB(): void { $query = 'delete from '.MAUTIC_TABLE_PREFIX.'leads where 1'; - $this->connection->query($query); + $this->connection->executeQuery($query); $query = 'delete from '.MAUTIC_TABLE_PREFIX.'custom_object where 1'; - $this->connection->query($query); + $this->connection->executeQuery($query); } private function generateContact(int $coProductId, int $cfPriceId, int $coOrderId, int $priceLimit): void @@ -220,9 +221,11 @@ private function generateProductRelations(int $contactId, int $coProductId, int } /** + * @param array $row + * * @return int Last inserted row ID * - * @throws DBALException + * @throws Exception */ private function insertInto(string $table, array $row): int { @@ -253,7 +256,7 @@ function ($value) { VALUES ($values) "; - $this->connection->query($query); + $this->connection->executeQuery($query); return (int) $this->connection->lastInsertId(); } diff --git a/EventListener/ImportSubscriber.php b/EventListener/ImportSubscriber.php index a90afe2c0..9e1ce7482 100644 --- a/EventListener/ImportSubscriber.php +++ b/EventListener/ImportSubscriber.php @@ -21,8 +21,8 @@ use MauticPlugin\CustomObjectsBundle\Provider\CustomItemRouteProvider; use MauticPlugin\CustomObjectsBundle\Repository\CustomFieldRepository; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\Form\Form; use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormInterface; use Symfony\Contracts\Translation\TranslatorInterface; class ImportSubscriber implements EventSubscriberInterface @@ -229,7 +229,7 @@ private function handleValidateOwner(array $matchedFields): ?int * * @param mixed[] $matchedFields */ - private function handleValidateRequired(Form $form, int $customObjectId, array $matchedFields): void + private function handleValidateRequired(FormInterface $form, int $customObjectId, array $matchedFields): void { $requiredFields = $this->customFieldRepository->getRequiredCustomFieldsForCustomObject($customObjectId);