Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UML-3460 Return LPA store LPAs via the new endpoint in the new format #2754

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fd015c0
UML-3460 Return LPA store LPAs via the new endpoint in the new format
allenannom Aug 21, 2024
32a4816
UML-3460 updating composer lock and test
allenannom Aug 22, 2024
bf087ef
Merge branch 'refs/heads/main' into UML-3460-return-lpa-store-via-new…
allenannom Aug 22, 2024
2d691b3
UML-3460 updating to psr standards
allenannom Aug 22, 2024
bfe5802
UML-3460 updating to psr standards
allenannom Aug 22, 2024
efa7b8b
UML-3460 added test case
allenannom Aug 22, 2024
3eaeac9
UML-3460 serialised objects, transforming enum and datetimes. used in…
allenannom Aug 28, 2024
c337892
Merge branch 'main' into UML-3460-return-lpa-store-via-new-endpoint-i…
allenannom Aug 28, 2024
c8e49bf
UML-3460 added tests for casters
allenannom Aug 28, 2024
615c359
UML-3460 fixed can_cast_single_donor test
allenannom Aug 29, 2024
52e32ab
UML-3460 updated test
allenannom Sep 2, 2024
7f56c22
UML-3460 updated tests
allenannom Sep 2, 2024
80f3920
UML-3460 renamed datastore to lpa store
allenannom Sep 2, 2024
099887c
Merge branch 'refs/heads/main' into UML-3460-return-lpa-store-via-new…
allenannom Sep 2, 2024
33939ff
UML-3460 using datetime immutable instead of interface
allenannom Sep 3, 2024
ca36a21
UML-3460 using datetime interface in DateToStringSerializer.php
allenannom Sep 3, 2024
5983fb8
Merge branch 'refs/heads/main' into UML-3460-return-lpa-store-via-new…
allenannom Sep 3, 2024
32fe33d
UML-3460 removed unnecessary lpastore person
allenannom Sep 3, 2024
72be528
UML-3460 CanSerialiseLpaStoreToModerniseFormatTest.php test
allenannom Sep 4, 2024
5014448
Merge branch 'refs/heads/main' into UML-3460-return-lpa-store-via-new…
allenannom Sep 4, 2024
1999c0f
UML-3460 fixed php lint errors
allenannom Sep 4, 2024
f6404d1
UML-3460 fixed dob not serializing, using lpa store example json for …
allenannom Sep 5, 2024
cb6b3a9
Merge branch 'refs/heads/main' into UML-3460-return-lpa-store-via-new…
allenannom Sep 5, 2024
f178773
UML-3460 fixed test - CastSingleDonorTest.php
allenannom Sep 5, 2024
c7bc837
Merge branch 'refs/heads/main' into UML-3460-return-lpa-store-via-new…
allenannom Sep 10, 2024
c5d6cc8
UML-3460 updated properties to alphabetic
allenannom Sep 10, 2024
3dfdc32
UML-3460 lint error
allenannom Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions service-api/app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@
"aws/aws-sdk-php": "^3.93",
"blazon/psr11-monolog": "^5.0",
"elie29/zend-phpdi-config": "^9.0",
"eventsauce/object-hydrator": "^1.4",
"facile-it/php-openid-client": "^0.3.5",
"guzzlehttp/guzzle": "^7.8.1",
"guzzlehttp/psr7": "^2.6.2",
"laminas/laminas-cache": "^3.11",
"laminas/laminas-cache-storage-adapter-apcu": "^2.4",
"laminas/laminas-config-aggregator": "^1.0",
"laminas/laminas-diactoros": "^3.0",
"laminas/laminas-hydrator": "^4.15",
"laminas/laminas-stdlib": "^3.1",
"mezzio/mezzio": "^3.0.1",
"mezzio/mezzio-fastroute": "^3.0",
Expand Down
155 changes: 148 additions & 7 deletions service-api/app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions service-api/app/src/App/src/Entity/Casters/CastSingleDonor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace App\Entity\Casters;

use App\Entity\LpaStore\LpaStoreDonor;
use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;
use EventSauce\ObjectHydrator\UnableToHydrateObject;

#[Attribute(Attribute::TARGET_PARAMETER)]
class CastSingleDonor implements PropertyCaster
{
/**
* @throws UnableToHydrateObject
*/
public function cast(mixed $value, ObjectMapper $hydrator): mixed
{
return $hydrator->hydrateObject(LpaStoreDonor::class, $value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace App\Entity\Casters;

use App\Enum\LpaType;
use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;

#[Attribute(Attribute::TARGET_PARAMETER)]
class CastToCaseSubtype implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): string
{
return LpaType::fromShortName($value)->value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace App\Entity\Casters;

use App\Enum\LifeSustainingTreatment;
use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;

#[Attribute(Attribute::TARGET_PARAMETER)]
class CastToLifeSustainingTreatment implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): mixed
{
return LifeSustainingTreatment::from($value)->value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace App\Entity\Casters;

use App\Enum\HowAttorneysMakeDecisions;
use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;

#[Attribute(Attribute::TARGET_PARAMETER)]
class CastToWhenTheLpaCanBeUsed implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): ?string
{
return HowAttorneysMakeDecisions::from($value)->value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Entity\Casters;

use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;

#[Attribute(Attribute::TARGET_PARAMETER)]
class ExtractAddressLine1FromLpaStore implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): ?string
{
if (is_array($value) && isset($value['line1'])) {
return $value['line1'];
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Entity\Casters;

use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;

#[Attribute(Attribute::TARGET_PARAMETER)]
class ExtractCountryFromLpaStore implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): ?string
{
if (is_array($value) && isset($value['country'])) {
return $value['country'];
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Entity\Casters;

use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;

#[Attribute(Attribute::TARGET_PARAMETER)]
class ExtractTownFromLpaStore implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): ?string
{
if (is_array($value) && isset($value['town'])) {
return $value['town'];
}

return null;
}
}
Loading
Loading