diff --git a/Client/YooChooseNotifier.php b/Client/YooChooseNotifier.php index 796eed0..5182e89 100644 --- a/Client/YooChooseNotifier.php +++ b/Client/YooChooseNotifier.php @@ -9,6 +9,7 @@ use eZ\Publish\API\Repository\ContentService; use eZ\Publish\API\Repository\ContentTypeService; use eZ\Publish\API\Repository\LocationService; +use Guzzle\Http\Message\Response; use GuzzleHttp\ClientInterface as GuzzleClient; use GuzzleHttp\Exception\RequestException; use InvalidArgumentException; @@ -405,9 +406,11 @@ private function notifyGuzzle6(array $events) ) ); - if (isset($this->logger)) { - $this->logger->debug('Got asynchronously ' . $promise->getState() . ' from YooChoose notification POST'); - } + $promise->wait(); + + $promise->then(function (Response $response) { + $this->log(sprintf('Got asynchronously %s from YooChoose notification POST', $response->getStatusCode()), 'debug'); + }); } /** diff --git a/Resources/config/services.yml b/Resources/config/services.yml index d5a88b4..f111145 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -39,25 +39,25 @@ services: # The configured eZ Publish Platform legacy search engine - enable lines below only if you're using legacy bridge. - # ez_recommendation.legacy.search_engine: - # class: ezpSearchEngine - # factory_class: EzSystems\RecommendationBundle\eZ\Publish\LegacySearch\LegacySearchFactory - # factory_method: build - # arguments: ["@ezpublish_legacy.kernel"] - - # ez_recommendation.legacy.recommendation_search_engine: - # class: EzSystems\RecommendationBundle\eZ\Publish\LegacySearch\RecommendationLegacySearchEngine - # arguments: - # - "@ez_recommendation.client.yoochoose_notifier" - # - "@ez_recommendation.legacy.search_engine" - - # ez_recommendation.legacy.search_configuration_mapper: - # class: EzSystems\RecommendationBundle\eZ\Publish\LegacySearch\ConfigurationMapper - # arguments: - # - "@ez_recommendation.legacy.recommendation_search_engine" - # - "@ezpublish.siteaccess" - # tags: - # - { name: kernel.event_subscriber } +# ez_recommendation.legacy.search_engine: +# class: ezpSearchEngine +# factory_class: EzSystems\RecommendationBundle\eZ\Publish\LegacySearch\LegacySearchFactory +# factory_method: build +# arguments: ["@ezpublish_legacy.kernel"] +# +# ez_recommendation.legacy.recommendation_search_engine: +# class: EzSystems\RecommendationBundle\eZ\Publish\LegacySearch\RecommendationLegacySearchEngine +# arguments: +# - "@ez_recommendation.client.yoochoose_notifier" +# - "@ez_recommendation.legacy.search_engine" +# +# ez_recommendation.legacy.search_configuration_mapper: +# class: EzSystems\RecommendationBundle\eZ\Publish\LegacySearch\ConfigurationMapper +# arguments: +# - "@ez_recommendation.legacy.recommendation_search_engine" +# - "@ezpublish.siteaccess" +# tags: +# - { name: kernel.event_subscriber } ez_recommendation.twig.extension: class: "%ez_recommendation.twig.extension.class%" @@ -154,6 +154,7 @@ services: - '@ezpublish.config.resolver.core' - '@ezpublish.image_alias.imagine.alias_generator' - '@ezpublish.fieldtype.ezrichtext.converter.output.xhtml5.core' + - "@?ezpublish.fieldtype.ezxmltext.converter.html5" ez_recommendation.rest.visitor.generator: class: "%ez_recommendation.rest.visitor.generator.class%" @@ -176,4 +177,3 @@ services: - [setApiEndpoint, ["%ez_recommendation.api_endpoint%"]] tags: - { name: ez_recommendation.rest.response_type, type: export } - diff --git a/Rest/Field/TypeValue.php b/Rest/Field/TypeValue.php index 309c8d3..c0139df 100644 --- a/Rest/Field/TypeValue.php +++ b/Rest/Field/TypeValue.php @@ -11,6 +11,7 @@ use eZ\Publish\API\Repository\Values\Content\Content; use eZ\Publish\API\Repository\Values\Content\Field; use eZ\Bundle\EzPublishCoreBundle\FieldType\RichText\Converter\Html5 as RichHtml5; +use eZ\Publish\Core\FieldType\XmlText\Converter\Html5 as XmlHtml5; use Symfony\Component\HttpFoundation\RequestStack; class TypeValue @@ -27,22 +28,28 @@ class TypeValue /** @var \eZ\Bundle\EzPublishCoreBundle\FieldType\RichText\Converter\Html5 */ private $richHtml5Converter; + /** @var \eZ\Publish\Core\FieldType\XmlText\Converter\Html5 */ + private $xmlHtml5Converter; + /** * @param \Symfony\Component\HttpFoundation\RequestStack $request * @param \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver $configResolver * @param \eZ\Bundle\EzPublishCoreBundle\Imagine\AliasGenerator $imageVariationService * @param \eZ\Bundle\EzPublishCoreBundle\FieldType\RichText\Converter\Html5 $richHtml5Converter + * @param \eZ\Publish\Core\FieldType\XmlText\Converter\Html5 $xmlHtml5Converter */ public function __construct( RequestStack $request, ConfigResolver $configResolver, ImageVariationService $imageVariationService, - RichHtml5 $richHtml5Converter + RichHtml5 $richHtml5Converter, + XmlHtml5 $xmlHtml5Converter = null ) { $this->request = $request; $this->configResolver = $configResolver; $this->imageVariationService = $imageVariationService; $this->richHtml5Converter = $richHtml5Converter; + $this->xmlHtml5Converter = $xmlHtml5Converter; } /** @@ -69,7 +76,19 @@ public function __call($fieldName, $args) */ public function ezxmltext(Field $field) { - return 'richHtml5Converter->convert($field->value->xml) . ']]>'; + return 'xmlHtml5Converter->convert($field->value->xml) . ']]>'; + } + + /** + * Method for parsing ezrichtext field. + * + * @param \eZ\Publish\API\Repository\Values\Content\Field $field + * + * @return string + */ + public function ezrichtext(Field $field) + { + return 'richHtml5Converter->convert($field->value->xml)->saveHTML() . ']]>'; } /** diff --git a/eZ/Publish/LegacySearch/RecommendationLegacySearchEngine.php b/eZ/Publish/LegacySearch/RecommendationLegacySearchEngine.php index 807298b..e5ff9fe 100644 --- a/eZ/Publish/LegacySearch/RecommendationLegacySearchEngine.php +++ b/eZ/Publish/LegacySearch/RecommendationLegacySearchEngine.php @@ -111,6 +111,12 @@ public function updateNodeSection($nodeID, $sectionID) public function updateNodeVisibility($nodeID, $action) { + if ($action == 'hide') { + $this->recommendationClient->hideLocation($nodeID); + } elseif ($action == 'show') { + $this->recommendationClient->unhideLocation($nodeID); + } + if (method_exists($this->legacySearchEngine, 'updateNodeVisibility')) { return $this->legacySearchEngine->updateNodeVisibility($nodeID, $action); }