Skip to content

Commit a8485bf

Browse files
committed
Merge branch 'release/2.1.2'
2 parents 9b025ec + a4ab512 commit a8485bf

13 files changed

+234
-45
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'phpdoc_align' => false,
1717
'no_superfluous_phpdoc_tags' => false,
1818
'array_syntax' => ['syntax' => 'short'],
19+
'phpdoc_to_comment' => false,
1920
'declare_strict_types' => true,
2021
ConstructorEmptyBracesFixer::name() => true,
2122
MultilinePromotedPropertiesFixer::name() => true,

CHANGELOG.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [2.1.2] - 2024-10-24
8+
9+
- [#213](https://github.com/os2display/display-api-service/pull/213)
10+
- Set `phpdoc_to_comment` to `false`in `.php-cs-fixer.dist.php` to avoid breaking psalm ignore
11+
- Add regions and groups to `ScreenInput.php`
12+
- Add "cascade: persist remove" to PlaylistScreenRegion
13+
- Save playlist/regions in `ScreenProcessor.php` and in `src/entity/ScreenLayoutRegions` (as an alternative to sending
14+
multiple requests)
15+
- Save groups in `ScreenProcessor.php` and in `src/entity/tenant/Screen.php`
16+
- Update psalm baseline
17+
- Add regions/playlists and groups to POST screen test
18+
- `composer update symfony/* --with-dependencies`
19+
-
720
## [2.1.1] - 2024-10-23
821

922
- [#217](https://github.com/os2display/display-api-service/pull/217)
@@ -13,6 +26,7 @@ All notable changes to this project will be documented in this file.
1326

1427
- [#214](https://github.com/os2display/display-api-service/pull/214)
1528
- Updated endSessionUrl to be nullable.
29+
1630
- [#193](https://github.com/os2display/display-api-service/pull/193)
1731
- Adds support for interactive slides.
1832
- Adds interactivity for creating quick bookings from a slide through Microsoft Graph.
@@ -69,8 +83,8 @@ All notable changes to this project will be documented in this file.
6983
- Changed route prefix to v2.
7084
- [#197](https://github.com/os2display/display-api-service/pull/197)
7185
- Fixed weight issue when assigning slides to playlist.
72-
- [#194](https://github.com/os2display/display-api-service/pull/194)
73-
Updated test run documentation and added test for `rrule` in playlist.
86+
- [#194](https://github.com/os2display/display-api-service/pull/194) Updated test run documentation and added test for
87+
`rrule` in playlist.
7488
- Fixed issue with PlaylistSlide transaction.
7589
- Fixed issues with feed following api platform upgrade.
7690
- [#192](https://github.com/os2display/display-api-service/pull/192)
@@ -92,8 +106,8 @@ All notable changes to this project will be documented in this file.
92106
- [#184](https://github.com/os2display/display-api-service/pull/184)
93107
- Added RelationsModifiedTrait to serialization groups.
94108
- [#182](https://github.com/os2display/display-api-service/pull/182)
95-
- Changed "Theme" api output to have "Logo" embedded to avoid 404 errors when fetching logo from other shared slide
96-
w. foreign tenant.
109+
- Changed "Theme" api output to have "Logo" embedded to avoid 404 errors when fetching logo from other shared slide w.
110+
foreign tenant.
97111
- [#181](https://github.com/os2display/display-api-service/pull/181)
98112
- Update minimum PHP version to 8.2 to support trait constants
99113
- Add 'relationsModified' timestamps on relevant entities and API resources.
@@ -114,16 +128,11 @@ All notable changes to this project will be documented in this file.
114128
- Switch from doctrine annotations to attributes
115129
- Add rector as dev dependency and apply rules
116130
- Handle doctrine deprecations
117-
- [#173](https://github.com/os2display/display-api-service/pull/173)
118-
Upgraded to API Platform 3
119-
- [#172](https://github.com/os2display/display-api-service/pull/172)
120-
Linted YAML API resources
121-
- [#171](https://github.com/os2display/display-api-service/pull/171)
122-
Fixed slide playlists collection operation.
123-
- [#170](https://github.com/os2display/display-api-service/pull/170)
124-
Updated Symfony development packages.
125-
- [#165](https://github.com/os2display/display-api-service/pull/165)
126-
Symfony 6.3
131+
- [#173](https://github.com/os2display/display-api-service/pull/173) Upgraded to API Platform 3
132+
- [#172](https://github.com/os2display/display-api-service/pull/172) Linted YAML API resources
133+
- [#171](https://github.com/os2display/display-api-service/pull/171) Fixed slide playlists collection operation.
134+
- [#170](https://github.com/os2display/display-api-service/pull/170) Updated Symfony development packages.
135+
- [#165](https://github.com/os2display/display-api-service/pull/165) Symfony 6.3
127136
- [#162](https://github.com/os2display/display-api-service/pull/162)
128137
- Adds "external" openid-connect provider.
129138
- Renamed "oidc" openid-connect provider to "internal".
@@ -133,9 +142,9 @@ All notable changes to this project will be documented in this file.
133142
- Upgrades openid-connect bundle to 3.1 to support multiple providers.
134143
- Changes php requirement in composer.json to >= 8.1.
135144
- Removed PHP Upgrade coding standards github actions check.
136-
- Changed user identifier from email to providerId. Made email nullable. Copied value from email to providerId in migration.
137-
- [#161](https://github.com/os2display/display-api-service/pull/161)
138-
Fixed non-entity related psalm errors.
145+
- Changed user identifier from email to providerId. Made email nullable. Copied value from email to providerId in
146+
migration.
147+
- [#161](https://github.com/os2display/display-api-service/pull/161) Fixed non-entity related psalm errors.
139148

140149
## [1.5.0] - 2023-10-26
141150

@@ -212,7 +221,8 @@ All notable changes to this project will be documented in this file.
212221
- [#138](https://github.com/os2display/display-api-service/pull/138)
213222
- Fixed Tenant and command to allow for empty fallbackImageUrl.
214223
- [#139](https://github.com/os2display/display-api-service/pull/139)
215-
- Changed from service decoration to event listeners to re-enable setting `tenants` on the response from `/v1/authentication/token`.
224+
- Changed from service decoration to event listeners to re-enable setting `tenants` on the response from
225+
`/v1/authentication/token`.
216226
- Ensure same response data from both `/v1/authentication/token` and `/v1/authentication/token/refresh`endpoints.
217227
- Added `user` and `tenants` to JWT payload.
218228

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,16 @@ the coding standard for the project.
258258

259259
- PHP files [PHP Coding Standards Fixer](https://cs.symfony.com/)
260260

261-
```shell
262-
docker compose exec phpfpm composer coding-standards-check
263-
```
261+
```shell
262+
docker compose exec phpfpm composer coding-standards-check
263+
```
264264

265265
- Markdown files (markdownlint standard rules)
266266

267-
```shell
268-
docker run --rm -v .:/app --workdir=/app node:20 npm install
269-
docker run --rm -v .:/app --workdir=/app node:20 npm run coding-standards-check
270-
```
267+
```shell
268+
docker run --rm -v .:/app --workdir=/app node:20 npm install
269+
docker run --rm -v .:/app --workdir=/app node:20 npm run coding-standards-check
270+
```
271271

272272
#### YAML
273273

@@ -281,23 +281,24 @@ To attempt to automatically fix coding style issues
281281

282282
- PHP files [PHP Coding Standards Fixer](https://cs.symfony.com/)
283283

284-
```sh
285-
docker compose exec phpfpm composer coding-standards-apply
286-
```
284+
```sh
285+
docker compose exec phpfpm composer coding-standards-apply
286+
```
287287

288288
- Markdown files (markdownlint standard rules)
289289

290-
```shell
291-
docker run --rm -v .:/app --workdir=/app node:18 npm install
292-
docker run --rm -v .:/app --workdir=/app node:18 npm run coding-standards-apply
293-
```
290+
```shell
291+
docker run --rm -v .:/app --workdir=/app node:18 npm install
292+
docker run --rm -v .:/app --workdir=/app node:18 npm run coding-standards-apply
293+
```
294294

295295
## Tests
296296

297297
Run automated tests:
298298

299299
```shell
300-
docker compose exec phpfpm composer tests
300+
docker compose exec phpfpm composer test setup
301+
docker compose exec phpfpm composer test
301302
```
302303

303304
Disable or hide deprecation warnings using the [`SYMFONY_DEPRECATIONS_HELPER` environment

psalm-baseline.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,6 @@
685685
<code><![CDATA[setSize]]></code>
686686
<code><![CDATA[setTitle]]></code>
687687
</PossiblyNullReference>
688-
<UndefinedClass>
689-
<code><![CDATA[InvalidArgumentException]]></code>
690-
</UndefinedClass>
691688
</file>
692689
<file src="src/State/ScreenProvider.php">
693690
<PossiblyNullPropertyAssignmentValue>
@@ -746,10 +743,10 @@
746743
</NullableReturnStatement>
747744
<PossiblyNullReference>
748745
<code><![CDATA[removeLogo]]></code>
749-
<code><![CDATA[setLogo]]></code>
750746
<code><![CDATA[setCreatedBy]]></code>
751747
<code><![CDATA[setCssStyles]]></code>
752748
<code><![CDATA[setDescription]]></code>
749+
<code><![CDATA[setLogo]]></code>
753750
<code><![CDATA[setModifiedBy]]></code>
754751
<code><![CDATA[setTitle]]></code>
755752
</PossiblyNullReference>

public/api-spec-v2.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11119,6 +11119,24 @@
1111911119
"boolean",
1112011120
"null"
1112111121
]
11122+
},
11123+
"regions": {
11124+
"type": [
11125+
"array",
11126+
"null"
11127+
],
11128+
"items": {
11129+
"type": "string"
11130+
}
11131+
},
11132+
"groups": {
11133+
"type": [
11134+
"array",
11135+
"null"
11136+
],
11137+
"items": {
11138+
"type": "string"
11139+
}
1112211140
}
1112311141
}
1112411142
},
@@ -11153,6 +11171,24 @@
1115311171
"boolean",
1115411172
"null"
1115511173
]
11174+
},
11175+
"regions": {
11176+
"type": [
11177+
"array",
11178+
"null"
11179+
],
11180+
"items": {
11181+
"type": "string"
11182+
}
11183+
},
11184+
"groups": {
11185+
"type": [
11186+
"array",
11187+
"null"
11188+
],
11189+
"items": {
11190+
"type": "string"
11191+
}
1115611192
}
1115711193
}
1115811194
},

public/api-spec-v2.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7735,6 +7735,18 @@ components:
77357735
type:
77367736
- boolean
77377737
- 'null'
7738+
regions:
7739+
type:
7740+
- array
7741+
- 'null'
7742+
items:
7743+
type: string
7744+
groups:
7745+
type:
7746+
- array
7747+
- 'null'
7748+
items:
7749+
type: string
77387750
Screen.ScreenInput.jsonld:
77397751
type: object
77407752
description: ''
@@ -7758,6 +7770,18 @@ components:
77587770
type:
77597771
- boolean
77607772
- 'null'
7773+
regions:
7774+
type:
7775+
- array
7776+
- 'null'
7777+
items:
7778+
type: string
7779+
groups:
7780+
type:
7781+
- array
7782+
- 'null'
7783+
items:
7784+
type: string
77617785
Screen.jsonld:
77627786
type: object
77637787
description: ''

src/Controller/PlaylistScreenRegionDeleteController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __invoke(string $id, string $regionId, string $playlistId): Json
2323
$regionUlid = $this->validationUtils->validateUlid($regionId);
2424
$playlistUlid = $this->validationUtils->validateUlid($playlistId);
2525

26-
$this->playlistScreenRegionRepository->deleteRelations($screenUlid, $regionUlid, $playlistUlid, $this->getActiveTenant());
26+
$this->playlistScreenRegionRepository->deleteRelations($screenUlid, $regionUlid, $playlistUlid);
2727

2828
return new JsonResponse(null, \Symfony\Component\HttpFoundation\Response::HTTP_NO_CONTENT);
2929
}

src/Dto/ScreenInput.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ class ScreenInput
1616
public string $orientation = '';
1717

1818
public ?bool $enableColorSchemeChange = null;
19+
public ?array $regions = null;
20+
public ?array $groups = null;
1921
}

src/Entity/ScreenLayoutRegions.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ScreenLayoutRegions extends AbstractBaseEntity implements MultiTenantInter
4141
/**
4242
* @var \Doctrine\Common\Collections\Collection<int, \App\Entity\Tenant\PlaylistScreenRegion>|\App\Entity\Tenant\PlaylistScreenRegion[]
4343
*/
44-
#[ORM\OneToMany(targetEntity: PlaylistScreenRegion::class, mappedBy: 'region', orphanRemoval: true)]
44+
#[ORM\OneToMany(targetEntity: PlaylistScreenRegion::class, cascade: ['persist', 'remove'], mappedBy: 'region', orphanRemoval: true)]
4545
private Collection $playlistScreenRegions;
4646

4747
public function __construct()
@@ -82,6 +82,18 @@ public function getPlaylistScreenRegions(): Collection
8282
return $this->playlistScreenRegions;
8383
}
8484

85+
public function setPlaylistScreenRegions(Collection $playlistScreenRegions): void
86+
{
87+
foreach ($this->playlistScreenRegions as $playlistScreenRegion) {
88+
if (false === $playlistScreenRegions->contains($playlistScreenRegion)) {
89+
$this->removePlaylistScreenRegion($playlistScreenRegion);
90+
}
91+
}
92+
foreach ($playlistScreenRegions as $playlistScreenRegion) {
93+
$this->addPlaylistScreenRegion($playlistScreenRegion);
94+
}
95+
}
96+
8597
public function addPlaylistScreenRegion(PlaylistScreenRegion $playlistScreenRegion): self
8698
{
8799
if (!$this->playlistScreenRegions->contains($playlistScreenRegion)) {

src/Entity/Tenant/Screen.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Screen extends AbstractTenantScopedEntity implements RelationsChecksumInte
5252
/**
5353
* @var \Doctrine\Common\Collections\Collection<int, \App\Entity\Tenant\PlaylistScreenRegion>|\App\Entity\Tenant\PlaylistScreenRegion[]
5454
*/
55-
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: PlaylistScreenRegion::class, orphanRemoval: true)]
55+
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: PlaylistScreenRegion::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
5656
#[ORM\OrderBy(['weight' => \Doctrine\Common\Collections\Order::Ascending->value])]
5757
private Collection $playlistScreenRegions;
5858

@@ -161,7 +161,7 @@ public function removePlaylistScreenRegion(PlaylistScreenRegion $playlistScreenR
161161

162162
public function removeAllPlaylistScreenRegions(): self
163163
{
164-
foreach ($this->playlistScreenRegions as $playlistScreenRegion) {
164+
foreach ($this->getPlaylistScreenRegions() as $playlistScreenRegion) {
165165
// set the owning side to null (unless already changed)
166166
if ($playlistScreenRegion->getScreen() === $this) {
167167
$playlistScreenRegion->removeScreen();
@@ -173,6 +173,18 @@ public function removeAllPlaylistScreenRegions(): self
173173
return $this;
174174
}
175175

176+
public function setScreenGroups(Collection $screenGroups): void
177+
{
178+
foreach ($this->screenGroups as $screenGroup) {
179+
if (false === $screenGroups->contains($screenGroup)) {
180+
$this->removeScreenGroup($screenGroup);
181+
}
182+
}
183+
foreach ($screenGroups as $screenGroup) {
184+
$this->addScreenGroup($screenGroup);
185+
}
186+
}
187+
176188
/**
177189
* @return Collection
178190
*/

src/Repository/PlaylistScreenRegionRepository.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,12 @@ public function updateRelations(Ulid $screenUlid, Ulid $regionUlid, ArrayCollect
119119
* @throws \Doctrine\ORM\ORMException
120120
* @throws \Doctrine\ORM\OptimisticLockException
121121
*/
122-
public function deleteRelations(Ulid $screenUlid, Ulid $regionUid, Ulid $playlistUlid, Tenant $tenant): void
122+
public function deleteRelations(Ulid $screenUlid, Ulid $regionUid, Ulid $playlistUlid): void
123123
{
124124
$playlistScreenRegion = $this->findOneBy([
125125
'screen' => $screenUlid,
126126
'region' => $regionUid,
127127
'playlist' => $playlistUlid,
128-
'tenant' => $tenant,
129128
]);
130129

131130
if (is_null($playlistScreenRegion)) {

0 commit comments

Comments
 (0)