fix conflict

This commit is contained in:
nobohan 2022-01-04 15:11:43 +01:00
commit aa6b770bfe
7 changed files with 45 additions and 46 deletions

View File

@ -17,7 +17,6 @@
"doctrine/orm": "^2.7", "doctrine/orm": "^2.7",
"erusev/parsedown": "^1.7", "erusev/parsedown": "^1.7",
"graylog2/gelf-php": "^1.5", "graylog2/gelf-php": "^1.5",
"knplabs/knp-menu": "^3.1",
"knplabs/knp-menu-bundle": "^3.0", "knplabs/knp-menu-bundle": "^3.0",
"knplabs/knp-time-bundle": "^1.12", "knplabs/knp-time-bundle": "^1.12",
"league/csv": "^9.7.1", "league/csv": "^9.7.1",
@ -32,6 +31,7 @@
"symfony/css-selector": "^4.4", "symfony/css-selector": "^4.4",
"symfony/expression-language": "^4.4", "symfony/expression-language": "^4.4",
"symfony/form": "^4.4", "symfony/form": "^4.4",
"symfony/framework-bundle": "^4.4",
"symfony/intl": "^4.4", "symfony/intl": "^4.4",
"symfony/mime": "^4.4", "symfony/mime": "^4.4",
"symfony/monolog-bundle": "^3.5", "symfony/monolog-bundle": "^3.5",
@ -47,8 +47,7 @@
"symfony/yaml": "^4.4", "symfony/yaml": "^4.4",
"twig/extra-bundle": "^3.0", "twig/extra-bundle": "^3.0",
"twig/intl-extra": "^3.0", "twig/intl-extra": "^3.0",
"twig/markdown-extra": "^3.3", "twig/markdown-extra": "^3.3"
"twig/twig": "^3.0"
}, },
"require-dev": { "require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.3", "doctrine/doctrine-fixtures-bundle": "^3.3",

View File

@ -859,11 +859,6 @@ parameters:
count: 1 count: 1
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
-
message: "#^Call to deprecated method setTimeout\\(\\) of class Redis\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php
- -
message: message:
""" """

View File

@ -388,7 +388,7 @@ final class ExportManagerTest extends KernelTestCase
public function testGetAggregatorNonExistant() public function testGetAggregatorNonExistant()
{ {
$this->expectException(\RuntimeException::class); $this->expectException(RuntimeException::class);
$exportManager = $this->createExportManager(); $exportManager = $this->createExportManager();
@ -446,7 +446,7 @@ final class ExportManagerTest extends KernelTestCase
public function testGetExportNonExistant() public function testGetExportNonExistant()
{ {
$this->expectException(\RuntimeException::class); $this->expectException(RuntimeException::class);
$exportManager = $this->createExportManager(); $exportManager = $this->createExportManager();
@ -485,7 +485,7 @@ final class ExportManagerTest extends KernelTestCase
public function testGetFilterNonExistant() public function testGetFilterNonExistant()
{ {
$this->expectException(\RuntimeException::class); $this->expectException(RuntimeException::class);
$exportManager = $this->createExportManager(); $exportManager = $this->createExportManager();
@ -646,7 +646,7 @@ final class ExportManagerTest extends KernelTestCase
public function testNonExistingFormatter() public function testNonExistingFormatter()
{ {
$this->expectException(\RuntimeException::class); $this->expectException(RuntimeException::class);
$exportManager = $this->createExportManager(); $exportManager = $this->createExportManager();

View File

@ -16,6 +16,7 @@ use Chill\MainBundle\Security\PasswordRecover\TokenManager;
use DateInterval; use DateInterval;
use DateTimeImmutable; use DateTimeImmutable;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use UnexpectedValueException;
/** /**
* @internal * @internal
@ -57,7 +58,7 @@ final class TokenManagerTest extends KernelTestCase
public function testGenerateEmptyUsernameCanonical() public function testGenerateEmptyUsernameCanonical()
{ {
$this->expectException(\UnexpectedValueException::class); $this->expectException(UnexpectedValueException::class);
$tokenManager = $this->tokenManager; $tokenManager = $this->tokenManager;
// set a username, but not a username canonical // set a username, but not a username canonical

View File

@ -28,17 +28,39 @@ use function array_values;
class PersonApiController extends ApiController class PersonApiController extends ApiController
{ {
private AuthorizationHelper $authorizationHelper; private AuthorizationHelper $authorizationHelper;
private ConfigPersonAltNamesHelper $configPersonAltNameHelper; private ConfigPersonAltNamesHelper $configPersonAltNameHelper;
public function __construct( public function __construct(
AuthorizationHelper $authorizationHelper, AuthorizationHelper $authorizationHelper,
ConfigPersonAltNamesHelper $configPersonAltNameHelper ConfigPersonAltNamesHelper $configPersonAltNameHelper
) ) {
{
$this->authorizationHelper = $authorizationHelper; $this->authorizationHelper = $authorizationHelper;
$this->configPersonAltNameHelper = $configPersonAltNameHelper; $this->configPersonAltNameHelper = $configPersonAltNameHelper;
} }
/**
* @Route("/api/1.0/person/config/alt_names.{_format}",
* name="chill_person_config_alt_names",
* requirements={
* "_format": "json"
* }
* )
*/
public function configAltNames(Request $request, string $_format): Response
{
$configAltNamesChoices = $this->configPersonAltNameHelper->getChoices();
return $this->json(
array_map(
static fn (array $data, string $key): array => ['key' => $key, 'labels' => $data],
$configAltNamesChoices,
array_keys($configAltNamesChoices)
),
Response::HTTP_OK, [], ['groups' => ['read']]
);
}
public function personAddressApi($id, Request $request, string $_format): Response public function personAddressApi($id, Request $request, string $_format): Response
{ {
return $this->addRemoveSomething('address', $id, $request, $_format, 'address', Address::class, ['groups' => ['read']]); return $this->addRemoveSomething('address', $id, $request, $_format, 'address', Address::class, ['groups' => ['read']]);
@ -76,27 +98,4 @@ class PersonApiController extends ApiController
return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]); return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]);
} }
/**
* @Route("/api/1.0/person/config/alt_names.{_format}",
* name="chill_person_config_alt_names",
* requirements={
* "_format": "json"
* }
* )
*/
public function configAltNames(Request $request, string $_format): Response
{
$configAltNamesChoices = $this->configPersonAltNameHelper->getChoices();
return $this->json(
array_map(
static fn (array $data, string $key): array => ['key' => $key, 'labels' => $data],
$configAltNamesChoices,
array_keys($configAltNamesChoices)
),
Response::HTTP_OK, [], ['groups' => ['read']]
);
}
} }

View File

@ -80,7 +80,7 @@ class PersonJsonNormalizer implements
} }
foreach (['firstName', 'lastName', 'phonenumber', 'mobilenumber', 'gender', foreach (['firstName', 'lastName', 'phonenumber', 'mobilenumber', 'gender',
'birthdate', 'deathdate', 'center', 'altNames'] 'birthdate', 'deathdate', 'center', 'altNames', ]
as $item) { as $item) {
if (!array_key_exists($item, $data)) { if (!array_key_exists($item, $data)) {
continue; continue;
@ -134,7 +134,10 @@ class PersonJsonNormalizer implements
case 'altNames': case 'altNames':
foreach ($data[$item] as $altName) { foreach ($data[$item] as $altName) {
$oldAltName = $person->getAltNames()->filter(function (PersonAltName $n) use ($altName) { return $n->getKey() === $altName['key']; })->first(); $oldAltName = $person
->getAltNames()
->filter(static fn (PersonAltName $n): bool => $n->getKey() === $altName['key'])->first();
if (false === $oldAltName) { if (false === $oldAltName) {
$newAltName = new PersonAltName(); $newAltName = new PersonAltName();
$newAltName->setKey($altName['key']); $newAltName->setKey($altName['key']);
@ -144,6 +147,7 @@ class PersonJsonNormalizer implements
$oldAltName->setLabel($altName['label']); $oldAltName->setLabel($altName['label']);
} }
} }
break; break;
default: default:

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Form\Type; namespace Chill\PersonBundle\Tests\Form\Type;
use Chill\PersonBundle\Form\Type\PickPersonType; use Chill\PersonBundle\Form\Type\PickPersonType;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use function count; use function count;
@ -52,7 +53,7 @@ final class PickPersonTypeTest extends KernelTestCase
*/ */
public function testWithInvalidOptionCenters() public function testWithInvalidOptionCenters()
{ {
$this->expectException(\RuntimeException::class); $this->expectException(RuntimeException::class);
$this->markTestSkipped('need to inject locale into url generator without request'); $this->markTestSkipped('need to inject locale into url generator without request');
$this->formFactory $this->formFactory