Skip to content
Snippets Groups Projects
Commit e64c2b24 authored by Thibaut Vallee's avatar Thibaut Vallee Committed by Bertrand Gauthier
Browse files

Suppression de la dépendance avec unicaen/app, et avec laminas/laminas-dependency-plugin.

parent 57234acf
Branches
Tags
No related merge requests found
Pipeline #34541 passed
Showing
with 71 additions and 27 deletions
Changelog
=========
7.2.0
-----
- Suppression de la dépendance avec unicaen/app, et avec laminas/laminas-dependency-plugin.
7.1.0
-----
- Rattrapage des évolutions réalisées dans la v6.2.0.
......
......@@ -14,10 +14,8 @@
"beberlei/assert": "^3.3",
"doctrine/dbal": "^3.4",
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"laminas/laminas-dependency-plugin": "^2.2",
"monolog/monolog": "^2.8",
"ramsey/uuid": "^3.0",
"unicaen/app": "^6.0",
"unicaen/livelog": "^4.0",
"unicaen/privilege": "^6.0",
"webmozart/assert": "^1.3"
......@@ -39,10 +37,5 @@
"psr-4": {
"UnicaenDbImportUnitTest\\": "test/UnicaenDbImportUnitTest"
}
},
"config": {
"allow-plugins": {
"laminas/laminas-dependency-plugin": true
}
}
}
......@@ -3,7 +3,7 @@
namespace UnicaenDbImport\CodeGenerator;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\CodeGenerator\Helper\LogTableHelper;
use UnicaenDbImport\CodeGenerator\Helper\TableHelper;
use UnicaenDbImport\CodeGenerator\Helper\TableValidationHelper;
......
......@@ -4,7 +4,7 @@ namespace UnicaenDbImport\CodeGenerator;
use BadMethodCallException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
class CodeGeneratorException extends RuntimeException
{
......
......@@ -2,7 +2,7 @@
namespace UnicaenDbImport\CodeGenerator;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\Domain\DestinationInterface;
use UnicaenDbImport\Domain\ResultInterface;
use UnicaenDbImport\Domain\SourceInterface;
......
......@@ -5,7 +5,7 @@ namespace UnicaenDbImport\CodeGenerator\Helper;
use DateTime;
use DateTimeZone;
use stdClass;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\CodeGenerator\Helper;
use UnicaenDbImport\Domain\DestinationInterface;
use UnicaenDbImport\Domain\Operation;
......
......@@ -3,7 +3,7 @@
namespace UnicaenDbImport\CodeGenerator\Helper;
use Doctrine\DBAL\Exception;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\CodeGenerator\Helper;
/**
......
......@@ -2,7 +2,7 @@
namespace UnicaenDbImport\Domain\Exception;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
class ConnectionException extends RuntimeException
{
......
......@@ -2,7 +2,7 @@
namespace UnicaenDbImport\Domain\Exception;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
class NotFoundException extends RuntimeException
{
......
......@@ -6,7 +6,7 @@ use DateTime;
use Exception;
use Generator;
use Ramsey\Uuid\Uuid;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
abstract class Result implements ResultInterface
{
......
<?php
namespace UnicaenDbImport\Entity\Db;
use Doctrine\ORM\EntityManager;
trait EntityManagerAwareTrait
{
protected EntityManager $entityManager;
public function setEntityManager(EntityManager $entityManager): void
{
$this->entityManager = $entityManager;
}
public function getEntityManager(): EntityManager
{
return $this->entityManager;
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
namespace UnicaenDbImport\Entity\Db\Service;
use Doctrine\ORM\EntityRepository;
use UnicaenApp\Service\EntityManagerAwareTrait;
use UnicaenDbImport\Entity\Db\EntityManagerAwareTrait;
abstract class AbstractService
{
......
......@@ -13,7 +13,7 @@ use GuzzleHttp\Exception\ServerException;
use Laminas\Http\Response;
use Psr\Log\LoggerAwareTrait;
use stdClass;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\Connection\ApiConnection;
use UnicaenDbImport\Domain\DestinationInterface;
use UnicaenDbImport\Domain\SourceInterface;
......
......@@ -6,11 +6,9 @@ use Exception;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Message;
use Psr\Http\Message\ResponseInterface;
use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Util;
use RuntimeException;
class ApiServiceException extends Exception
{
......@@ -38,7 +36,7 @@ class ApiServiceException extends Exception
{
return new self(sprintf(
"Erreur rencontrée lors du décodage de la réponse JSON du WS (URI '%s') : %s. Début de la réponse reçue : %s",
$uri, json_last_error_msg(), Util::truncatedString($responseBody, 100)
$uri, json_last_error_msg(), static::truncatedString($responseBody, 100)
));
}
......@@ -67,4 +65,33 @@ class ApiServiceException extends Exception
return new self($message, null, $error);
}
/**
* Tronque une chaîne de caractères au dernier espace trouvé dans les N premiers caractères de celle-ci.
*
* @param string $string Chaîne de caractères à tronquer
* @param int $length N
* @param string $appended Ajouté à la fin de la chaîne tronquée
*/
static protected function truncatedString(string $string, int $length = 60, string $appended = '...'): string
{
if (strlen($string) <= $length) {
return $string;
}
$trunc = substr($string, 0, $length);
if ($string[$length] === ' ') {
$kept = $trunc;
} else {
$found = strrpos($trunc, ' '); // position du dernier espace
if ($found === false) {
$kept = $trunc;
} else {
$kept = substr($string, 0, $found); // on tronque à l'espace trouvé
}
}
return $kept . $appended;
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ use Exception;
use InvalidArgumentException;
use Psr\Log\LoggerAwareTrait;
use stdClass;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\Connection\ApiConnection;
use UnicaenDbImport\Connection\NoConnection;
use UnicaenDbImport\Domain\DestinationInterface;
......
......@@ -4,7 +4,7 @@ namespace UnicaenDbImport\Service;
use Exception;
use Psr\Log\LoggerAwareTrait;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\Config\Config;
use UnicaenDbImport\Domain\Exception\NotFoundException;
use UnicaenDbImport\Domain\NameAwareInterface;
......
......@@ -3,7 +3,7 @@
namespace UnicaenDbImportUnitTest\CodeGenerator\PostgreSQL\Helper;
use PHPUnit_Framework_TestCase;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\CodeGenerator\PostgreSQL\Helper\TableValidationHelper;
class TableValidationHelperTest extends PHPUnit_Framework_TestCase
......
......@@ -94,7 +94,7 @@ class ConfigTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException \UnicaenApp\Exception\RuntimeException
* @expectedException \RuntimeException
*/
public function test_importer_getter_throws_exception_when_destination_provides_null_database_platform()
{
......@@ -108,7 +108,7 @@ class ConfigTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException \UnicaenApp\Exception\RuntimeException
* @expectedException \RuntimeException
*/
public function test_importer_getter_throws_exception_when_config_returns_null_importer()
{
......
......@@ -6,7 +6,7 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\Statement;
use Exception;
use PHPUnit_Framework_TestCase;
use UnicaenApp\Exception\RuntimeException;
use RuntimeException;
use UnicaenDbImport\CodeGenerator\CodeGenerator;
use UnicaenDbImport\CodeGenerator\PostgreSQL\Helper\TableValidationHelper;
use UnicaenDbImport\Service\DatabaseFacade;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment