Skip to content

Commit 3ff4b71

Browse files
authored
Merge branch 'main' into feat/can-organization-intervene-on-geometry
2 parents 8cdea6d + 9f6a22e commit 3ff4b71

File tree

14 files changed

+89
-30
lines changed

14 files changed

+89
-30
lines changed

config/validator/Application/SigningAuthority/SaveSigningAuthorityCommand.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
<option name="max">100</option>
2222
</constraint>
2323
</property>
24-
<property name="address">
24+
<property name="roadName">
25+
<constraint name="NotBlank"/>
26+
</property>
27+
<property name="cityCode">
28+
<constraint name="NotBlank"/>
29+
</property>
30+
<property name="cityLabel">
2531
<constraint name="NotBlank"/>
2632
</property>
2733
</class>

src/Application/Organization/SigningAuthority/Command/SaveSigningAuthorityCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(
2626
$this->address = $signingAuthority?->getAddress();
2727
$this->roadName = $signingAuthority?->getRoadName();
2828
$this->cityCode = $signingAuthority?->getCityCode();
29-
$this->roadName = $signingAuthority?->getCityLabel();
29+
$this->cityLabel = $signingAuthority?->getCityLabel();
3030
$this->placeOfSignature = $signingAuthority?->getPlaceOfSignature();
3131
$this->signatoryName = $signingAuthority?->getSignatoryName();
3232
}

src/Application/Organization/SigningAuthority/Command/SaveSigningAuthorityCommandHandler.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ public function __construct(
1919
public function __invoke(SaveSigningAuthorityCommand $command): SigningAuthority
2020
{
2121
if ($signingAuthority = $command->signingAuthority) {
22-
$command->roadName = null;
23-
$command->cityCode = null;
24-
$command->cityLabel = null;
25-
2622
$signingAuthority->update(
2723
name: $command->name,
2824
address: $command->address,

src/Domain/Organization/SigningAuthority/SigningAuthority.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ class SigningAuthority
1111
public function __construct(
1212
private string $uuid,
1313
private string $name,
14-
private string $address,
1514
private string $placeOfSignature,
1615
private string $signatoryName,
1716
private Organization $organization,
1817
private ?string $roadName = null,
1918
private ?string $cityCode = null,
2019
private ?string $cityLabel = null,
20+
private ?string $address = null,
2121
) {
2222
}
2323

@@ -31,7 +31,7 @@ public function getName(): string
3131
return $this->name;
3232
}
3333

34-
public function getAddress(): string
34+
public function getAddress(): ?string
3535
{
3636
return $this->address;
3737
}
@@ -68,19 +68,19 @@ public function getOrganization(): Organization
6868

6969
public function update(
7070
string $name,
71-
string $address,
7271
string $placeOfSignature,
7372
string $signatoryName,
7473
?string $roadName,
7574
?string $cityCode,
7675
?string $cityLabel,
76+
?string $address,
7777
): void {
7878
$this->name = $name;
79-
$this->address = $address;
8079
$this->placeOfSignature = $placeOfSignature;
8180
$this->signatoryName = $signatoryName;
8281
$this->roadName = $roadName;
8382
$this->cityCode = $cityCode;
8483
$this->cityLabel = $cityLabel;
84+
$this->address = $address;
8585
}
8686
}

src/Infrastructure/Form/Organization/SigningAuthorityFormType.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Symfony\Component\Form\AbstractType;
88
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
9-
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
109
use Symfony\Component\Form\Extension\Core\Type\TextType;
1110
use Symfony\Component\Form\FormBuilderInterface;
1211

@@ -24,11 +23,25 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2423
],
2524
)
2625
->add(
27-
'address',
28-
TextareaType::class,
26+
'roadName',
27+
TextType::class,
28+
options: [
29+
'label' => 'signing_authority.roadName',
30+
'help' => 'signing_authority.roadName.help',
31+
],
32+
)
33+
->add(
34+
'cityCode',
35+
TextType::class,
36+
options: [
37+
'label' => 'signing_authority.cityCode',
38+
],
39+
)
40+
->add(
41+
'cityLabel',
42+
TextType::class,
2943
options: [
30-
'label' => 'signing_authority.address',
31-
'help' => 'signing_authority.address.help',
44+
'label' => 'signing_authority.cityLabel',
3245
],
3346
)
3447
->add(

src/Infrastructure/Persistence/Doctrine/Fixtures/SigningAuthorityFixture.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ public function load(ObjectManager $manager): void
1717
$signatoryAuthority = new SigningAuthority(
1818
uuid: '9cebe00d-04d8-48da-89b1-059f6b7bfe44',
1919
name: 'Monsieur le maire de Savenay',
20-
address: '3 rue de la Concertation',
2120
placeOfSignature: 'Savenay',
2221
signatoryName: 'Monsieur X, Maire de Savenay',
2322
organization: $this->getReference('mainOrg', Organization::class),
24-
roadName: null,
25-
cityCode: null,
26-
cityLabel: null,
23+
roadName: '3 rue de la Concertation',
24+
cityCode: '75018',
25+
cityLabel: 'Paris',
26+
address: null,
2727
);
2828

2929
$manager->persist($signatoryAuthority);

src/Infrastructure/Persistence/Doctrine/Mapping/Organization.SigningAuthority.SigningAuthority.orm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
table="signing_authority">
66
<id name="uuid" type="guid" column="uuid"/>
77
<field name="name" type="string" length="100" nullable="false"/>
8-
<field name="address" type="string" nullable="false"/>
8+
<field name="address" type="string" nullable="true"/>
99
<field name="roadName" type="string" nullable="true"/>
1010
<field name="cityCode" type="string" nullable="true"/>
1111
<field name="cityLabel" type="string" nullable="true"/>

src/Infrastructure/Persistence/Doctrine/Migrations/Version20250306142031.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function up(Schema $schema): void
2323
$this->addSql('ALTER TABLE signing_authority ADD road_name VARCHAR(255) DEFAULT NULL');
2424
$this->addSql('ALTER TABLE signing_authority ADD city_code VARCHAR(255) DEFAULT NULL');
2525
$this->addSql('ALTER TABLE signing_authority ADD city_label VARCHAR(255) DEFAULT NULL');
26+
$this->addSql('ALTER TABLE signing_authority ALTER address DROP NOT NULL');
2627
}
2728

2829
public function down(Schema $schema): void
@@ -31,5 +32,6 @@ public function down(Schema $schema): void
3132
$this->addSql('ALTER TABLE signing_authority DROP road_name');
3233
$this->addSql('ALTER TABLE signing_authority DROP city_code');
3334
$this->addSql('ALTER TABLE signing_authority DROP city_label');
35+
$this->addSql('ALTER TABLE signing_authority ALTER address SET NOT NULL');
3436
}
3537
}

templates/my_area/organization/signing_authority/detail.html.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
</p>
2424
<ul>
2525
<li><b>{{ 'signing_authority.name'|trans }}</b> : {{ signingAuthority.name|default('N/D') }}</li>
26-
<li><b>{{ 'signing_authority.address'|trans }}</b> : {{ signingAuthority.address|default('N/D') }}</li>
26+
<li><b>{{ 'signing_authority.address'|trans }}</b> : {{ signingAuthority.roadName|default('N/D') }} {{ signingAuthority.cityCode|default('N/D') }}
27+
{{ signingAuthority.cityLabel|default('N/D') }}</li>
2728
<li><b>{{ 'signing_authority.placeOfSignature'|trans }}</b> : {{ signingAuthority.placeOfSignature|default('N/D') }}</li>
2829
<li><b>{{ 'signing_authority.signatoryName'|trans }}</b> : {{ signingAuthority.signatoryName|default('N/D') }}</li>
2930
</ul>

templates/my_area/organization/signing_authority/form.html.twig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121
<div class="fr-grid-row fr-grid-row--gutters fr-grid-row--end fr-mb-2w">
2222
<div class="fr-col-12 fr-col-md-6">
2323
{{ form_row(form.name, { group_class: 'fr-input-group', widget_class: 'fr-input' }) }}
24-
{{ form_row(form.address, { group_class: 'fr-input-group', widget_class: 'fr-input' }) }}
24+
{{ form_row(form.roadName, { group_class: 'fr-input-group', widget_class: 'fr-input' }) }}
25+
26+
<div class="fr-grid-row fr-grid-row--gutters fr-grid-row--end fr-mb-2w">
27+
<div class="fr-col-12 fr-col-xl-4">
28+
{{ form_row(form.cityCode, { group_class: 'fr-input-group', widget_class: 'fr-input' }) }}
29+
</div>
30+
<div class="fr-col-12 fr-col-xl-8">
31+
{{ form_row(form.cityLabel, { group_class: 'fr-input-group', widget_class: 'fr-input' }) }}
32+
</div>
33+
</div>
34+
2535
{{ form_row(form.placeOfSignature, { group_class: 'fr-input-group', widget_class: 'fr-input' }) }}
2636
{{ form_row(form.signatoryName, { group_class: 'fr-input-group', widget_class: 'fr-input' }) }}
2737
</div>

0 commit comments

Comments
 (0)