Skip to content

Commit 9b84bf9

Browse files
authored
Merge pull request #5 from CommonGateway/feature/NH-10/fix-action
fix for endpoint
2 parents f14ffd5 + ec8ef59 commit 9b84bf9

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ Basic knowledge of the [Common Gateway](https://github.com/CommonGateway)
5050

5151
This template is for rapid Symfony bundle development and meant as a model to base your custom plugin on. Follow the next steps to create your plugin within 45 minutes or less
5252

53-
1. Login on [GitHub](https://github.com)
54-
2. Use [this template](https://github.com/CommonGateway/-HaalCentraalToStufBG/generate)
55-
3. Name your Bundle (CamelCase). The bundle needs to end with `Bundle` as per Symfony [naming](https://symfony.com/doc/current/bundles/best_practices.html#bundles-naming-conventions) conventions.
56-
4. Press the green button `Create repository from template`
57-
5. Update file names and namespace to your fitting :
53+
1. Login on [GitHub](https://github.com)
54+
2. Use [this template](https://github.com/CommonGateway/-HaalCentraalToStufBG/generate)
55+
3. Name your Bundle (CamelCase). The bundle needs to end with `Bundle` as per Symfony [naming](https://symfony.com/doc/current/bundles/best_practices.html#bundles-naming-conventions) conventions.
56+
4. Press the green button `Create repository from template`
57+
5. Update file names and namespace to your fitting :
5858

59-
* Open composer.json, and change the name to your fitting. The first word should be the namespace, and the second the bundle's name.
59+
* Open composer.json, and change the name to your fitting. The first word should be the namespace, and the second the bundle's name.
6060

61-
> Note: this is kebab-case. Also read: [naming your package](https://packagist.org/about#naming-your-package)
61+
> Note: this is kebab-case. Also read: [naming your package](https://packagist.org/about#naming-your-package)
6262
63-
* Check the autoload field to be set accordingly.
64-
* Open PetStoreBundle.php and change the Bundle `name` and `namespace`. The namespace should be the same as your package name in `composer.json` but in CamelCase. So `common-gateway/pet-store-bundle` becomes `CommonGateway/-HaalCentraalToStufBG`
65-
* Rename the `/Service` and `/ActionHandler` accordingly (or delete if not used).
66-
* Rename the `/DependencyInjection/PetStoreExtension.php` to your `BundleNameExtension.php`
67-
* Rename the `/Resources/config/services.yaml` namespaces
63+
* Check the autoload field to be set accordingly.
64+
* Open PetStoreBundle.php and change the Bundle `name` and `namespace`. The namespace should be the same as your package name in `composer.json` but in CamelCase. So `common-gateway/pet-store-bundle` becomes `CommonGateway/-HaalCentraalToStufBG`
65+
* Rename the `/Service` and `/ActionHandler` accordingly (or delete if not used).
66+
* Rename the `/DependencyInjection/PetStoreExtension.php` to your `BundleNameExtension.php`
67+
* Rename the `/Resources/config/services.yaml` namespaces
6868

6969
### Adding schemas
7070

@@ -74,17 +74,23 @@ You can add existing schemas or create your own and add them to the`/Schema` fol
7474

7575
The following properties are required, and without them, the Gateway won't recognize the schema as valid:
7676

77-
- `version` can start on '0.1.0.'
77+
```
78+
- `version` can start on '0.1.0.'
79+
```
7880

7981
> without this property, you can't update schemes
8082
81-
- `$schema` (https://docs.commongateway.nl/schemas/Entity.schema.json)
82-
- `$id` (https://example.com/schema/{Your scheme name}.schema.json)
83+
```
84+
- `$schema` (https://docs.commongateway.nl/schemas/Entity.schema.json)
85+
- `$id` (https://example.com/schema/{Your scheme name}.schema.json)
86+
```
8387

8488
> Unique `$id` to be relatable to other schemas.
8589
86-
- `type` must be 'object'
87-
- `properties` must be schema properties
90+
```
91+
- `type` must be 'object'
92+
- `properties` must be schema properties
93+
```
8894

8995
Once you add schemas to the repository, you can also add objects/data for those schemas. There is an example shown in the [`/Data`](https://github.com/CommonGateway/-HaalCentraalToStufBG/tree/main/Data) folder.
9096

src/Service/HaalCentraalToStufBGService.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,14 @@ public function getAllRelatives(Source $source, array $ingeschrevenPersoon): ?ar
116116
'ouders' => [],
117117
'kinderen' => [],
118118
];
119+
119120
foreach ($fetchedPeople as $type => $people) {
120121
if (isset($ingeschrevenPersoon['_links'][$type]) === true) {
121122
foreach ($ingeschrevenPersoon['_links'][$type] as $link) {
122123
// Remove domain etc from link so we have a endpoint.
123-
$endpoint = str_replace(str_replace('https', 'http', $source->getLocation()), '', $link['href']);
124+
$endpoint = \Safe\parse_url($link['href'], PHP_URL_PATH);
125+
$endpoint = explode('/haal-centraal-brp-bevragen/api/v1.3/ingeschrevenpersonen', $endpoint)[1];
126+
124127
$fetchedPeople[$type][] = $this->fetchPerson($source, $endpoint);
125128
}
126129
}

0 commit comments

Comments
 (0)