Performs custom process on hard delete of content.

@param  AbstractClassContent $content
@return self
323942
protected function cleanUpContentHardDelete(AbstractClassContent $content)
    {
        $this->_em->getConnection()->executeUpdate(
            'DELETE FROM indexation WHERE owner_uid = :uid',
            [
                'uid' => $content->getUid(),
            ]
        );

        $revisions = $this->_em->getRepository('BackBee\ClassContent\Revision')->findBy(['_content' => $content]);
        foreach ($revisions as $revision) {
            $this->_em->remove($revision);
        }

        return $this;
    }
377809
public function wrapInner($content)
    {
        foreach ($this as $i => $node) {
            /** @var \DOMNode $node */
            self::create($node->childNodes)->wrapAll($content);
        }
        return $this;
    }
1253109
public function removeRawContent($contentId)
    {
        $this->locationGateway->removeElementFromTrash(
            $this->loadContentInfo($contentId)->mainLocationId
        );

        foreach ($this->listVersions($contentId) as $versionInfo) {
            $this->fieldHandler->deleteFields($contentId, $versionInfo);
        }
        // Must be called before deleteRelations()
        $this->contentGateway->removeReverseFieldRelations($contentId);
        $this->contentGateway->deleteRelations($contentId);
        $this->contentGateway->deleteVersions($contentId);
        $this->contentGateway->deleteNames($contentId);
        $this->contentGateway->deleteContent($contentId);
    }
832258
public static function onFlushContent(Event $event)
    {
        $content = $event->getTarget();
        if (!($content instanceof AbstractClassContent)) {
            return;
        }

        $page = $content->getMainNode();
        if (null === $page) {
            return;
        }

        $newEvent = new Event($page, $content);
        $newEvent->setDispatcher($event->getDispatcher());
        self::onFlushPage($newEvent);
    }
1021508
public function setContent($content)
    {
        if (is_array($content) || $content instanceof ArrayAccess || $content instanceof JsonSerializable) {
            $this->headers->add(['Content-Type' => 'application/json; charset=utf-8']);
            $content = json_encode($content, JSON_UNESCAPED_UNICODE);
        }

        parent::setContent($content);
        parent::setCharset('utf-8');

        return $this;
    }
954818
private function setContent($content)
    {
        $this->content = $content;

        if (empty($this->contentType)) {
            return;
        }

        //Remove charset from Content-Type
        if (strpos($this->contentType, ';') !== false) {
            list($mime, $charset) = array_map('trim', explode(';', $this->contentType));

            $this->contentType = $mime;
            $charset = str_replace(['"', "'"], '', substr(strstr($charset, '='), 1));
            $this->content = Utils::toUtf8($content, trim($charset));
        }
    }
1278038
public function setContent(AbstractClassContent $content = null)
    {
        $this->_content = $content;

        if (null !== $this->_content) {
            $this->setClassname(ClassUtils::getRealClass($this->_content));
        }

        return $this->getContentInstance();
    }
74358
public function prependContent($content)
    {
        if (!empty($content)) {
            if (is_array($this->content)) {
                array_unshift($this->content, $content);
            } else {
                $this->content = $content . $this->content;
            }
        }
        return $this;
    }
68939
public function cleanKeywordLinks(AbstractClassContent $content, $keywords)
    {
        if (!is_array($keywords)) {
            $keywords = [$keywords];
        }

        $keywordUids = [];
        foreach ($keywords as $keyword) {
            if (
                $keyword instanceof Keyword
                && !empty($keyword->value)
                && (null !== $realKeyword = $this->_em->find('BackBee\NestedNode\KeyWord', $keyword->value))
            ) {
                $keywordUids[] = $realKeyword->getUid();
            }
        }

        $query = $this->_em
            ->getConnection()
            ->createQueryBuilder()
            ->select('c.keyword_uid')
            ->from('keywords_contents', 'c')
        ;
        $query->where($query->expr()->eq('c.content_uid', $query->expr()->literal($content->getUid())));
        $savedKeywords = $query->execute()->fetchAll(\PDO::FETCH_COLUMN);

        $linksToBeRemoved = array_diff($savedKeywords, $keywordUids);
        if (count($linksToBeRemoved)) {
            $query = $this->_em
                ->getConnection()
                ->createQueryBuilder()
                ->delete('keywords_contents')
            ;

            array_walk(
                $linksToBeRemoved,
                function(&$value, $key, $query) {
                    $value = $query->expr()->literal($value);
                },
                $query
            );

            $query
                ->where($query->expr()->eq('content_uid', $query->expr()->literal($content->getUid())))
                ->andWhere($query->expr()->in('keyword_uid', $linksToBeRemoved))
                ->execute()
            ;
        }
    }
845731
public function setContent($content)
    {
        if ($this->isVoid) {
            throw new Exception\RuntimeException(
                'Void elements can\'t contain content.'
            );
        }

        $this->content = $content;

        return $this;
    }
254575
public function setContent($content)
    {
        if (is_null($this->mbRequest)) {
            return $this;
        }

        $this->prepare($this->mbRequest);

        if ($this->mbRequest->isMethod("GET") || $this->mbRequest->isMethod("DELETE")) {
            $this->statusCode = BaseResponse::HTTP_OK;
        } elseif ($this->mbRequest->isMethod("POST") || $this->mbRequest->isMethod("PUT")) {
            $this->statusCode = BaseResponse::HTTP_CREATED;
        } else {
            $this->statusCode = BaseResponse::HTTP_RESET_CONTENT;
        }

        if ($content instanceof \Exception) {
            $this->statusCode = $content->getCode();
            $this->statusCode = $this->isSuccessful() ? $this->statusCode : BaseResponse::HTTP_BAD_REQUEST;
        }

        if($this->isBuffer()){
            $this->original = $content;
        } elseif ($this->mbRequest->isAjax()) {
            $this->ajaxContent($content);
        } else {
            $this->htmlContent($content);
        }

        return $this;
    }
584896
public function visit(vfsStreamContent $content)
    {
        switch ($content->getType()) {
            case vfsStreamContent::TYPE_FILE:
                $this->visitFile($content);
                break;

            case vfsStreamContent::TYPE_DIR:
                $this->visitDirectory($content);
                break;

            default:
                throw new InvalidArgumentException('Unknown content type');
        }

        return $this;
    }
1252333
public function removeIdxSiteContent(Site $site, AbstractClassContent $content)
    {
        $query = 'DELETE FROM idx_site_content WHERE site_uid = :site AND (content_uid IN '.
                '(SELECT content_uid FROM content_has_subcontent WHERE parent_uid = :content)'.
                'OR content_uid = :content)';

        $params = array(
            'site' => $site->getUid(),
            'content' => $content->getUid(),
        );

        return $this->executeUpdate($query, $params);
    }
1309098
public function setContent($content)
    {
        $this->content = $content;
        $this->setHeader('content-length', strlen($this->content));
    }
781235
private function updateContentElements(AbstractClassContent $content, array $elementsData)
    {
        foreach ($elementsData as $key => $data) {
            if (in_array('Element\Keyword', $content->getAccept()[$key])) {
                $this->entityManager
                        ->getRepository('BackBee\ClassContent\Element\Keyword')
                        ->updateKeywordLinks($content, $data, $this->token);
            }
            $content->$key = $data;
        }

        return $this;
    }
793424
private function buildCategoryFromClassContent(AbstractClassContent $content)
    {
        foreach ((array) $content->getProperty('category') as $category) {
            $visible = true;
            if ('!' === $category[0]) {
                $visible = false;
                $category = substr($category, 1);
            }

            $id = $this->buildCategoryId($category);
            if (false === array_key_exists($id, $this->categories)) {
                $this->categories[$id] = new Category($category, $this->options);
                ksort($this->categories);
            }

            $this->categories[$id]->addBlock($content, $visible, $this->options);
        }
    }
1261695
public function setContent( Content $content )
    {
        foreach ( $this->handlers as $handler )
        {
            if ( $handler instanceof ContentAwareHandlerInterface )
            {
                $handler->setContent( $content );
            }
        }
    }