Checks to see if content has the given file.
Used when saving content.

@param string $file path + name
@param int $contentid
@return string|int File ID or NULL if not found
511334
public function removeContentFile($file, $contentId) {
    $path = "{$this->path}/content/{$contentId}/{$file}";
    if (file_exists($path)) {
      unlink($path);

      // Clean up any empty parent directories to avoid cluttering the file system
      $parts = explode('/', $path);
      while (array_pop($parts) !== NULL) {
        $dir = implode('/', $parts);
        if (is_dir($dir) && count(scandir($dir)) === 2) { // empty contains '.' and '..'
          rmdir($dir); // Remove empty parent
        }
        else {
          return; // Not empty
        }
      }
    }
  }
211835
public function mapContentById($contentId)
    {
        $contentInfo = $this->contentHandler->loadContentInfo($contentId);

        return $this->mapContent(
            $this->contentHandler->load($contentId, $contentInfo->currentVersionNo)
        );
    }
505293
public static function createFile($file, $content = '')
    {
        $folder = dirname($file);
        if (!is_dir($folder)) {
            self::createFolder($folder);
        }

        file_put_contents($file, $content);
    }
673018
public function loadContentVersions($contentId, Request $request)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);

        return new Values\VersionList(
            $this->repository->getContentService()->loadVersions($contentInfo),
            $request->getPathInfo()
        );
    }
271299
public function exists($id)
    {
        if (!$this->isTtlMode()) {
            return file_exists($this->getPath($id));
        } else {
            return $this->get($id) !== false;
        }
    }
979900
public function getFieldById(ContentTypeInterface $contentType, $fieldId)
    {
        $field = $this->om->getRepository($this->configurationManager->getEntityClass('field'))->find($fieldId);


        if (!$field instanceof FieldInterface) {
            return null;
        }
        if ($field->getContentType() && $field->getContentType()->getId() == $contentType->getId()) {
            return $field;
        }

        $parent = $field;
        while ($parent && $parentLayout = $parent->getLayout()) {
            if ($parent = $parentLayout->getParent()) {
                if ($parent->getContentType() !== null && $parent->getContentType()->getId() == $contentType->getId()) {
                    return $field;
                }
            }
        }

        return null;
    }
704052
public function deleteContent($contentId)
    {
        $this->repository->getContentService()->deleteContent(
            $this->repository->getContentService()->loadContentInfo($contentId)
        );

        return new Values\NoContent();
    }
517069
public function hasFile(string $name) : bool
    {
        return $this->fileContentAreas->any(function (FileContentArea $contentArea) use ($name) {
            return $contentArea->name === $name;
        });
    }
1279275
function getContentUid(content) {
    var id = content.id_;
    if (!id)
      id = content.id_ = contentUidCounter++;
    return id;
  }
258657
private function findContentfulEntry(string $id): ?ContentfulEntry
    {
        return $this->entityManager->getRepository(ContentfulEntry::class)->find($id);
    }
401502
public function contentfulContentTypeName(string $contentTypeId): string
    {
        $contentType = $this->contentful->getContentType($contentTypeId);
        if (!$contentType instanceof ContentType) {
            return '';
        }

        return $contentType->getName();
    }
778415
private function getContentIdentifier($contentId)
    {
        $contentType = $this->contentTypeService->loadContentType(
            $this->contentService
                ->loadContent($contentId)
                ->contentInfo
                ->contentTypeId
        );

        return $contentType->identifier;
    }
149083
private function loadContent(int $contentId, string $language): Content
    {
        return $this->repository->getContentService()->loadContent($contentId, [$language]);
    }
203669
public function findByFileId($fileId)
    {
        foreach ($this->volumes as $volume) {
            try {
                $file = $volume->findFile($fileId);
                if ($file) {
                    return $volume;
                }
            } catch (\Exception $e) {
            }
        }

        return null;
    }
472178
public static function append(string $file, string $content): int
    {
        if (!self::exists(dirname($file))) {
            self::mkDir(dirname($file));
        }
        return file_put_contents($file, $content, FILE_APPEND);
    }
246618
public function getContentIdsByContentTypeId($contentTypeId)
    {
        $query = $this->dbHandler->createSelectQuery();
        $query
            ->select($this->dbHandler->quoteColumn('id'))
            ->from($this->dbHandler->quoteTable('ezcontentobject'))
            ->where(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_id'),
                    $query->bindValue($contentTypeId, null, PDO::PARAM_INT)
                )
            );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(PDO::FETCH_COLUMN);
    }
102646
protected function parseFileID($fileID)
    {
        /** @var ParsedFileID $parsedFileID */
        $parsedFileID = $this->getProtectedResolutionStrategy()->parseFileID($fileID);
        return $parsedFileID ? $parsedFileID->getTuple() : null;
    }