File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -413,3 +413,12 @@ Feature: Access to unpublished/draft resources should be configurable
413413 And the resource component_position should exist
414414 And the resource publishable_draft should exist
415415 And the resource publishable_published should not exist
416+
417+ @loginAdmin
418+ Scenario : When deleting a component the component position should NOT be deleted if a draft component exists as well
419+ Given there is a publishable resource set to publish at "2999-12-31T23:59:59+00:00"
420+ And there is a ComponentPosition with the resource "publishable_draft"
421+ When I send a "DELETE" request to the resource "publishable_draft" and the postfix "?published=false"
422+ Then the response status code should be 204
423+ And the resource component_position should not exist
424+ And the resource publishable_draft should not exist
Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ private function removeEmptyPositions(ViewEvent $event): void
8383 $ configuration = $ this ->publishableAttributeReader ->getConfiguration ($ className );
8484 $ classMetadata = $ this ->getClassMetadata ($ className );
8585 $ draftResource = $ classMetadata ->getFieldValue ($ data , $ configuration ->reverseAssociationName ) ?? $ data ;
86- if ($ draftResource ) {
86+
87+ if ($ draftResource && $ data !== $ draftResource ) {
8788 foreach ($ positions as $ position ) {
8889 $ position ->component = $ draftResource ;
8990 }
You can’t perform that action at this time.
0 commit comments