Skip to content

Commit 9fdf604

Browse files
author
manuel.flamminio
committed
feat(Customizations): add customized fields for JobAds
1 parent 85bf321 commit 9fdf604

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

lib/Model/CustomizableModelAbstract.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
abstract class CustomizableModelAbstract
66
{
77
public function __construct(private array $customizableFields)
8-
{}
8+
{
9+
}
910

1011
/**
1112
* @return mixed
@@ -19,9 +20,20 @@ public function getCustomizableFields(): array
1920
* @param mixed $customizableFields
2021
* @return CustomizableModelAbstract
2122
*/
22-
public function setCustomizableFields(array $customizableFields)
23+
public function setCustomizableFields(array $customizableFields): self
2324
{
2425
$this->customizableFields = $customizableFields;
2526
return $this;
2627
}
28+
29+
/**
30+
* @param array $customizableFields
31+
* @return $this
32+
*/
33+
public function addCustomizableFields(array $customizableFields): self
34+
{
35+
$fields = $this->customizableFields ?? [];
36+
$this->customizableFields = array_merge($fields, $customizableFields);
37+
return $this;
38+
}
2739
}

lib/Model/JobadCommonData.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* @link https://openapi-generator.tech
4242
* @implements \ArrayAccess<string, mixed>
4343
*/
44-
class JobadCommonData implements ModelInterface, ArrayAccess, \JsonSerializable
44+
class JobadCommonData extends CustomizableModelAbstract implements ModelInterface, ArrayAccess, \JsonSerializable
4545
{
4646
public const DISCRIMINATOR = null;
4747

@@ -400,6 +400,7 @@ public function __construct(array $data = null)
400400
$this->setIfExists('benefits', $data ?? [], null);
401401
$this->setIfExists('expiration_date', $data ?? [], null);
402402
$this->setIfExists('status', $data ?? [], null);
403+
parent::__construct([]);
403404
}
404405

405406
/**

lib/Model/JobadCommonOptionalData.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* @link https://openapi-generator.tech
4242
* @implements \ArrayAccess<string, mixed>
4343
*/
44-
class JobadCommonOptionalData implements ModelInterface, ArrayAccess, \JsonSerializable
44+
class JobadCommonOptionalData extends CustomizableModelAbstract implements ModelInterface, ArrayAccess, \JsonSerializable
4545
{
4646
public const DISCRIMINATOR = null;
4747

@@ -400,6 +400,7 @@ public function __construct(array $data = null)
400400
$this->setIfExists('benefits', $data ?? [], null);
401401
$this->setIfExists('expiration_date', $data ?? [], null);
402402
$this->setIfExists('status', $data ?? [], null);
403+
parent::__construct([]);
403404
}
404405

405406
/**

0 commit comments

Comments
 (0)