Removes content from optimized table.

@param  \BackBee\ClassContent\AbstractClassContent $content

@return \BackBee\ClassContent\Repository\IndexationRepository
330939
public function removeOptContentTable(AbstractClassContent $content)
    {
        $this->getEntityManager()
                ->createQuery('DELETE FROM BackBee\ClassContent\Indexes\OptContentByModified o WHERE o._uid=:uid')
                ->setParameter('uid', $content->getUid())
                ->execute();

        return $this;
    }
921992
private function getClassContentCacheNodeParameter(AbstractClassContent $content)
    {
        $classnames = array(ClassUtils::getRealClass($content));

        $content_uids = $this->em->getRepository('\BackBee\ClassContent\Indexes\IdxContentContent')
            ->getDescendantsContentUids($content)
        ;

        if (0 < count($content_uids)) {
            $classnames = array_merge(
                $classnames,
                $this->em->getRepository('\BackBee\ClassContent\AbstractClassContent')->getClassnames($content_uids)
            );
        }

        $node_parameter = null;
        foreach ($classnames as $classname) {
            if (false === class_exists($classname)) {
                continue;
            }

            $object = new $classname();
            if (null !== $parameters = $object->getProperty('cache-param')) {
                if (true === isset($parameters['node'])) {
                    $node_parameter = $parameters['node'];
                    break;
                }
            }
        }

        return $node_parameter;
    }
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;
    }
1359510
private function updateElements(AbstractClassContent $content, array $elementsData)
    {
        if ($content instanceof ContentSet) {
            $elements = $this->prepareElements($elementsData, false);
            $page = $this->isMainZone($content);
            $this->updateContentSetElements($content, $elements, $page);
        } else {
            $elements = $this->prepareElements($elementsData);
            $this->updateContentElements($content, $elements);
        }

        return $this;
    }
709961
public function deleteRegions($content, $regions)
    {
        foreach ($regions as $region) {
            $region->detach();
            $this->manager->remove($region);
            $this->manager->flush();
        }
    }
8708
private function resolveContentSet(ContentSet $content, array $matches)
    {
        if ('ContentSet' === $matches[1]) {
            return $content->item($matches[3]);
        }

        $index = intval($matches[3]);
        $classname = AbstractClassContent::getFullClassname(str_replace('/', NAMESPACE_SEPARATOR, $matches[1]));

        foreach ($content as $subcontent) {
            if (get_class($subcontent) !== $classname) {
                continue;
            }

            if (0 === $index) {
                return $subcontent;
            }

            $index--;
        }

        return $content;
    }
39518
public function setContent($content)
    {
        if(strlen($content) > 9900)
        {
            throw new \InvalidArgumentException('Maximum content length is 9900 characters');
        }

        $this->content = $content;

        $this->setHash(sha1($content));

        return $this;
    }
574061
public function removeEmptyPTag($content)
    {
        $content    = force_balance_tags($content);
        $content    = preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
        $content    = preg_replace('~\s?<p>(\s|&nbsp;)+</p>\s?~', '', $content);

        return $content;
    }
517258
public function removeContent(\Coral\ContentBundle\Entity\Content $contents)
    {
        $this->contents->removeElement($contents);
    }
704052
public function deleteContent($contentId)
    {
        $this->repository->getContentService()->deleteContent(
            $this->repository->getContentService()->loadContentInfo($contentId)
        );

        return new Values\NoContent();
    }
640716
public function strip($content)
    {
        if (empty($this->registered)) {
            return $content;
        }
        $pattern = $this->getRegex();

        return preg_replace_callback("/{$pattern}/s", [$this, 'stripTag'], $content);
    }
951250
public static function cleanContent($content)
    {
        $content = self::stripControlCharacters($content);
        // remove Javascript
        $content = preg_replace('@<script[^>]*>.*?<\/script>@msi', '', $content);

        // remove internal CSS styles
        $content = preg_replace('@<style[^>]*>.*?<\/style>@msi', '', $content);

        // prevents concatenated words when stripping tags afterwards
        $content = str_replace(['<', '>'], [' <', '> '], $content);
        $content = static::stripTags($content);

        $content = str_replace(["\t", "\n", "\r", '&nbsp;'], ' ', $content);
        $content = self::stripUnicodeRanges($content);
        $content = preg_replace('/\s{2,}/', ' ', $content);
        $content = trim($content);

        return $content;
    }
455208
public function withContent(Readable $content): self
    {
        $file = clone $this;
        $file->content = $content;

        return $file;
    }
9485
public function deleteImportedContent() {
    $uuids = $this->state->get('govcms8_default_content_uuids', []);
    $by_entity_type = array_reduce(array_keys($uuids), function ($carry, $uuid) use ($uuids) {
      $entity_type_id = $uuids[$uuid];
      $carry[$entity_type_id][] = $uuid;
      return $carry;
    }, []);
    foreach ($by_entity_type as $entity_type_id => $entity_uuids) {
      $storage = $this->entityTypeManager->getStorage($entity_type_id);
      $entities = $storage->loadByProperties(['uuid' => $entity_uuids]);
      $storage->delete($entities);
    }
    return $this;
  }
590007
public function getParentContents(AbstractClassContent $content)
    {
        $result = $this->_em->getConnection()
            ->createQueryBuilder()
            ->select('p.parent_uid', 'c.classname')
            ->from('content_has_subcontent', 'p')
            ->leftJoin('p', 'content', 'c', 'p.parent_uid = c.uid')
            ->where('p.content_uid = :uid')
            ->setParameter('uid', $content->getUid())
            ->execute()
            ->fetchAll()
        ;

        $parents = [];
        foreach ($result as $parentData) {
            $parentData['classname'] = AbstractClassContent::getFullClassname($parentData['classname']);
            $parents[] = $this->_em->find($parentData['classname'], $parentData['parent_uid']);
        }

        return $parents;
    }
1277021
private static function updateSuperContentIndexes(AbstractClassContent $content)
    {
        $alreadyIndexed = self::$em->getRepository('BackBee\ClassContent\Indexation')->findBy(['_owner' => $content]);
        foreach ($alreadyIndexed as $index) {
            if (null === $field = $index->getField()) {
                continue;
            }

            list($value, $owner) = self::getIndexValue($index->getContent(), $field);

            $callback = unserialize($index->getCallback());
            if (null !== $callback) {
                $value = self::applyCallbacks($value, (array) $callback);
            }

            if (null !== $value) {
                $index->setValue($value);
                self::$em->getRepository('BackBee\ClassContent\Indexation')->save($index);
            }
        }
    }
1131290
private function removeIdxContentContent(AbstractClassContent $content)
    {
        $query = 'DELETE FROM idx_content_content WHERE content_uid = :child OR subcontent_uid = :child';

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

        return $this->executeUpdate($query, $params);
    }