Skip to content

Commit 6806e3d

Browse files
authored
Add HeadlessWebsiteController refactoring to upgrade (#156)
1 parent bf4aef7 commit 6806e3d

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

UPGRADE.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,44 @@ Symfony 5.4 support was dropped. Minimum required version is now 6.4.
2424
- Search hit `score` field removed
2525
- Search hit `document.properties` (excerpt, state, etc.) removed — no longer included in response
2626
- Search hit fields changed: `id`, `title`, `url`, `locale` remain; new fields: `resourceKey`, `resourceId`, `content`, `authoredAt`, `webspaces`, `_formatted`, `media`
27+
- Media `type` field changed from an object `{"name": "image", "id": 2}` to a plain string (e.g. `"image"`)
28+
29+
### HeadlessWebsiteController refactored
30+
31+
The `HeadlessWebsiteController` now extends `ContentController` (from `Sulu\Content\UserInterface\Controller\Website`) instead of `WebsiteController`.
32+
33+
The `indexAction` signature changed to match the new base controller:
34+
35+
```php
36+
// Before
37+
public function indexAction(
38+
Request $request,
39+
StructureInterface $structure,
40+
bool $preview = false,
41+
bool $partial = false
42+
): Response;
43+
44+
// After
45+
public function indexAction(
46+
Request $request,
47+
DimensionContentInterface $object,
48+
string $view,
49+
bool $preview = false,
50+
bool $partial = false,
51+
): Response;
52+
```
53+
54+
The `resolveStructure(StructureInterface $structure)` method was renamed to `resolveHeadlessData(DimensionContentInterface $object, string $locale)`:
55+
56+
```php
57+
// Before
58+
protected function resolveStructure(StructureInterface $structure): array;
59+
60+
// After
61+
protected function resolveHeadlessData(DimensionContentInterface $object, string $locale): array;
62+
```
63+
64+
The `serializeData()` helper method was removed. For non-JSON requests, override `resolveSuluParameters()` instead of `renderStructure()` — the `headless` key is now added there.
2765

2866
### StructureResolverInterface signature changed
2967

0 commit comments

Comments
 (0)