1818use Drupal \Core \KeyValueStore \KeyValueStoreInterface ;
1919use Drupal \pantheon_content_publisher \Entity \PantheonDocument ;
2020use Symfony \Component \DependencyInjection \ContainerInterface ;
21+ use Symfony \Component \HttpFoundation \RequestStack ;
2122
2223/**
2324 * Provides a list controller for the pantheon content publisher entity type.
@@ -37,6 +38,7 @@ public function __construct(
3738 protected EntityStorageInterface $ collectionStorage ,
3839 protected PantheonContentPublisherConverter $ pantheonContentPublisherConverter ,
3940 KeyValueFactoryInterface $ keyValueFactory ,
41+ protected RequestStack $ requestStack ,
4042 ) {
4143 $ this ->seenStore = $ keyValueFactory ->get ('pantheon_document.seen ' );
4244 parent ::__construct ($ entity_type , $ entity_field_manager , $ cache , $ memory_cache , $ entity_type_bundle_info );
@@ -51,7 +53,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
5153 $ container ->get ('entity_type.bundle.info ' ),
5254 $ container ->get ('entity_type.manager ' )->getStorage ('pantheon_document_collection ' ),
5355 $ container ->get ('pantheon_content_publisher.converter ' ),
54- $ container ->get ('keyvalue ' )
56+ $ container ->get ('keyvalue ' ),
57+ $ container ->get ('request_stack ' ),
5558 );
5659 }
5760
@@ -71,7 +74,7 @@ protected function doLoadMultiple(?array $ids = NULL) {
7174 $ drupal_data = $ this ->pantheonContentPublisherConverter
7275 ->convert ($ pantheon_data , $ collection_name , $ id );
7376 $ document = PantheonDocument::create ($ drupal_data );
74- if ($ this ->seenStore ->setIfNotExists ($ id , 1 )) {
77+ if ($ this ->requestStack -> getCurrentRequest ()-> getMethod () === ' POST ' && $ this -> seenStore ->setIfNotExists ($ id , 1 )) {
7578 $ this ->invokeHook ('insert ' , $ document );
7679 }
7780 $ entities [$ id ] = $ document ->enforceIsNew (FALSE );
0 commit comments