src/Offer/ReadModel/JSONLD/OfferLDProjector.php
protected function applyDescriptionUpdated(
        AbstractDescriptionUpdated $descriptionUpdated
    ) {
        $document = $this->loadDocumentFromRepository($descriptionUpdated);

        $offerLd = $document->getBody();
        if (empty($offerLd->description)) {
            $offerLd->description = new \stdClass();
        }

        $mainLanguage = isset($offerLd->mainLanguage) ? $offerLd->mainLanguage : 'nl';
        $offerLd->description->{$mainLanguage} = $descriptionUpdated->getDescription()->toNative();

        return $document->withBody($offerLd);
    }
protected function applyDescriptionUpdated(
        AbstractDescriptionUpdated $descriptionUpdated
    ) {
        $document = $this->loadDocumentFromRepository($descriptionUpdated);

        $offerLd = $document->getBody();
        if (empty($offerLd->description)) {
            $offerLd->description = new \stdClass();
        }

        $mainLanguage = isset($offerLd->mainLanguage) ? $offerLd->mainLanguage : 'nl';
        $offerLd->description->{$mainLanguage} = $descriptionUpdated->getDescription()->toNative();

        return $document->withBody($offerLd);
    }
protected function applyDescriptionUpdated ( AbstractDescriptionUpdated $ descriptionUpdated ) { $ document = $ this -> loadDocumentFromRepository ( $ descriptionUpdated ) ; $ offerLd = $ document -> getBody ( ) ; if ( empty ( $ offerLd -> description ) ) { $ offerLd -> description = new \ stdClass ( ) ; } $ mainLanguage = isset ( $ offerLd -> mainLanguage ) ? $ offerLd -> mainLanguage : 'nl' ; $ offerLd -> description -> { $ mainLanguage } = $ descriptionUpdated -> getDescription ( ) -> toNative ( ) ; return $ document -> withBody ( $ offerLd ) ; }
Apply the description updated event to the offer repository.
@param AbstractDescriptionUpdated $descriptionUpdated
@return JsonDocument
Apply the description updated event to the offer repository .