Skip to content

Commit 3468c18

Browse files
committed
refactor: replace address field with street_name, house_number, and address_addition in AdditionalAddress and Contact classes; mark old address field as deprecated
1 parent 33d454e commit 3468c18

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

src/Resources/Contacts/AdditionalAddresses/AdditionalAddress.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ class AdditionalAddress extends Resource
2222
const DELETE_REQUEST = DeleteAdditionalAddressRequest::class;
2323
const QUERY_BUILDER = AdditionalAddressQueryBuilder::class;
2424

25+
26+
/** @deprecated use street_name, house_number, address_addition instead. */
27+
public readonly ?string $address;
28+
2529
public function __construct(
2630
public ?int $id = null,
2731
public ?int $contact_id = null,
2832
public ?string $name = null,
29-
public ?string $address = null,
33+
public ?string $street_name = null,
34+
public ?string $house_number = null,
35+
public ?string $address_addition = null,
3036
public ?string $postcode = null,
3137
public ?string $city = null,
3238
public ?int $country_id = null,

src/Resources/Contacts/Contacts/Contact.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class Contact extends Resource
3333
public ?string $updated_at;
3434
public ?string $profile_image;
3535

36+
/** @deprecated use street_name, house_number, address_addition instead. */
37+
public readonly ?string $address;
38+
3639
public function __construct(
3740
public int|ContactType $contact_type_id = ContactType::COMPANY,
3841
public ?int $id = null,
@@ -43,7 +46,9 @@ public function __construct(
4346
public ?string $salutation_form = null,
4447
public ?int $titel_id = null,
4548
public ?string $birthday = null,
46-
public ?string $address = null,
49+
public ?string $street_name = null,
50+
public ?string $house_number = null,
51+
public ?string $address_addition = null,
4752
public ?string $postcode = null,
4853
public ?string $city = null,
4954
public ?int $country_id = null,

tests/Resources/Contacts/AdditionalAddresses/AdditionalAddressRequestsTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
id: null,
1414
contact_id: testContactId(),
1515
name: fake()->word(),
16-
address: fake()->streetAddress(),
16+
street_name: fake()->streetName(),
17+
house_number: fake()->buildingNumber(),
18+
address_addition: fake()->secondaryAddress(),
1719
postcode: fake()->postcode(),
1820
city: fake()->city(),
1921
subject: fake()->sentence(),

tests/Resources/Contacts/Contacts/ContactRequestsTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
it('can create a Contact', function () use (&$testContact) {
1616
$contact = new Contact(
17+
contact_type_id: fake()->randomElement([ContactType::PERSON, ContactType::COMPANY]),
1718
name_1: fake()->firstName(),
18-
contact_type_id: ContactType::PERSON,
1919
name_2: fake()->lastName(),
20-
address: fake()->streetAddress(),
20+
street_name: fake()->streetName(),
21+
house_number: fake()->buildingNumber(),
2122
postcode: fake()->randomNumber(4),
2223
city: fake()->city(),
2324
mail: fake()->safeEmail(),

0 commit comments

Comments
 (0)