From b4bf3c0cf367791cc76e7620f05ccdcf17d83348 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Fri, 4 Feb 2022 17:44:02 +0100 Subject: [PATCH 1/2] Add Tip for Tags --- bundles/trash.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bundles/trash.rst b/bundles/trash.rst index bd86943d..d5ab49c3 100644 --- a/bundles/trash.rst +++ b/bundles/trash.rst @@ -117,6 +117,13 @@ with the correct data. } } +.. Tip:: + + If `TrashItemHandler` is created outside of a Sulu sulu/skeleton application, for example in a separate bundle, the automatic autowire of the Trash bundle does not work. + In this case the handler must be tagged with the following tags. + ``sulu_trash.store_trash_item_handler`` , ``sulu_trash.restore_trash_item_handler`` and ``sulu_trash.restore_configuration_provider``. + + (Optional) Add restore configuration for your entity ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 8507267e8adb04733139c3769fec04896e919cc8 Mon Sep 17 00:00:00 2001 From: Prokyonn Date: Fri, 26 Apr 2024 14:30:37 +0200 Subject: [PATCH 2/2] Add review suggestions --- bundles/trash.rst | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/bundles/trash.rst b/bundles/trash.rst index d5ab49c3..69acd4be 100644 --- a/bundles/trash.rst +++ b/bundles/trash.rst @@ -74,6 +74,12 @@ in time. } } +.. Tip:: + + If you're using the default `services.yaml configuration from Symfony`_, the example should work as is. + However, if you've created a custom ``TrashItemHandler`` in a separate bundle, be sure to tag the service with + ``sulu_trash.store_trash_item_handler`` to ensure proper functionality. + Restore an entity from a trash item ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,9 +125,9 @@ with the correct data. .. Tip:: - If `TrashItemHandler` is created outside of a Sulu sulu/skeleton application, for example in a separate bundle, the automatic autowire of the Trash bundle does not work. - In this case the handler must be tagged with the following tags. - ``sulu_trash.store_trash_item_handler`` , ``sulu_trash.restore_trash_item_handler`` and ``sulu_trash.restore_configuration_provider``. + If you're using the default `services.yaml configuration from Symfony`_, the example should work as is. + However, if you've created a custom ``TrashItemHandler`` in a separate bundle, be sure to tag the service with + ``sulu_trash.restore_trash_item_handler`` to ensure proper functionality. (Optional) Add restore configuration for your entity @@ -165,6 +171,12 @@ previous steps to implement the ``RestoreConfigurationProviderInterface`` and re } } +.. Tip:: + + If you're using the default `services.yaml configuration from Symfony`_, the example should work as is. + However, if you've created a custom ``TrashItemHandler`` with the restore functionality in a separate bundle, + be sure to tag the service also with ``sulu_trash.restore_configuration_provider`` to ensure proper functionality. + The ``RestoreConfiguration`` class allows to set the following configuration properties. All configuration properties are optional an can be set to ``null``. @@ -202,6 +214,12 @@ This extension point allows to clean up external data when a trash item is remov cannot be restored anymore. For example, this can be used to clean up associated files on the hard drive or related data in an external system. +.. Tip:: + + If you're using the default `services.yaml configuration from Symfony`_, the example should work as is. + However, if you've created a custom ``TrashItemHandler`` with the restore functionality in a separate bundle, + be sure to tag the service also with ``sulu_trash.remove_trash_item_handler`` to ensure proper functionality. + .. _TrashItem entity: https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/TrashBundle/Domain/Model/TrashItem.php .. _TrashManager service: https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/TrashBundle/Application/TrashManager/TrashManager.php .. _StoreTrashItemHandlerInterface interface: https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/TrashBundle/Application/TrashItemHandler/StoreTrashItemHandlerInterface.php @@ -209,3 +227,4 @@ drive or related data in an external system. .. _RemoveTrashItemHandlerInterface interface: https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/TrashBundle/Application/TrashItemHandler/RemoveTrashItemHandlerInterface.php .. _RestoreConfiguration object: https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/TrashBundle/Application/RestoreConfigurationProvider/RestoreConfiguration.php .. _RestoreConfigurationProviderInterface interface: https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/TrashBundle/Application/RestoreConfigurationProvider/RestoreConfigurationProviderInterface.php +.. _services.yaml configuration from Symfony: https://symfony.com/doc/6.4/service_container.html#service-container-services-load-example \ No newline at end of file