EventListener/SyncExecuteConsumeEventListener.php
protected function persistDocument()
    {
        $syncStorageData = $this->getSyncStorageData();
        switch ($syncStorageData['type']) {
            case ActionTypes::CREATE:
                $this->getElasticsearchManager()->persist($this->getItem()->getDocument());
                break;
            case ActionTypes::UPDATE:
                $this->getElasticsearchManager()->persist($this->getItem()->getDocument());
                break;
            case ActionTypes::DELETE:
                $this->getElasticsearchManager()->getRepository($this->getDocumentClass())->remove(
                    $this->getItem()->getDocument()->getId()
                );
                break;
            default:
                $this->log(
                    sprintf(
                        'Failed to update document of type  %s id: %s: no valid operation type defined',
                        get_class($this->getItem()->getDocument()),
                        $this->getItem()->getDocument()->getId()
                    )
                );

                return false;
        }
        $this->getSyncStorage()->deleteItem(
            $syncStorageData['id'],
            [$syncStorageData['shop_id']]
        );

        return true;
    }
protected function persistDocument()
    {
        $syncStorageData = $this->getSyncStorageData();
        switch ($syncStorageData['type']) {
            case ActionTypes::CREATE:
                $this->getElasticsearchManager()->persist($this->getItem()->getDocument());
                break;
            case ActionTypes::UPDATE:
                $this->getElasticsearchManager()->persist($this->getItem()->getDocument());
                break;
            case ActionTypes::DELETE:
                $this->getElasticsearchManager()->getRepository($this->getDocumentClass())->remove(
                    $this->getItem()->getDocument()->getId()
                );
                break;
            default:
                $this->log(
                    sprintf(
                        'Failed to update document of type  %s id: %s: no valid operation type defined',
                        get_class($this->getItem()->getDocument()),
                        $this->getItem()->getDocument()->getId()
                    )
                );

                return false;
        }
        $this->getSyncStorage()->deleteItem(
            $syncStorageData['id'],
            [$syncStorageData['shop_id']]
        );

        return true;
    }
protected function persistDocument ( ) { $ syncStorageData = $ this -> getSyncStorageData ( ) ; switch ( $ syncStorageData [ 'type' ] ) { case ActionTypes :: CREATE : $ this -> getElasticsearchManager ( ) -> persist ( $ this -> getItem ( ) -> getDocument ( ) ) ; break ; case ActionTypes :: UPDATE : $ this -> getElasticsearchManager ( ) -> persist ( $ this -> getItem ( ) -> getDocument ( ) ) ; break ; case ActionTypes :: DELETE : $ this -> getElasticsearchManager ( ) -> getRepository ( $ this -> getDocumentClass ( ) ) -> remove ( $ this -> getItem ( ) -> getDocument ( ) -> getId ( ) ) ; break ; default : $ this -> log ( sprintf ( 'Failed to update document of type  %s id: %s: no valid operation type defined' , get_class ( $ this -> getItem ( ) -> getDocument ( ) ) , $ this -> getItem ( ) -> getDocument ( ) -> getId ( ) ) ) ; return false ; } $ this -> getSyncStorage ( ) -> deleteItem ( $ syncStorageData [ 'id' ] , [ $ syncStorageData [ 'shop_id' ] ] ) ; return true ; }
{@inheritdoc}
{