eZ\Publish\Core\SignalSlot\Repository::getContentTypeService PHP Method

getContentTypeService() public method

Get service object to perform operations on Content Type objects and it's aggregate members. ( Group, Field & FieldCategory )
public getContentTypeService ( ) : eZ\Publish\API\Repository\ContentTypeService
return eZ\Publish\API\Repository\ContentTypeService
    public function getContentTypeService()
    {
        if ($this->contentTypeService !== null) {
            return $this->contentTypeService;
        }
        $this->contentTypeService = new ContentTypeService($this->repository->getContentTypeService(), $this->signalDispatcher);
        return $this->contentTypeService;
    }

Usage Example

 /**
  * Returns ContentType identifier based on $contentId.
  *
  * @param int|mixed $contentId
  *
  * @return string
  */
 private function getContentTypeIdentifier($contentId)
 {
     $contentTypeService = $this->repository->getContentTypeService();
     $contentService = $this->repository->getContentService();
     $contentType = $this->repository->sudo(function () use($contentId, $contentTypeService, $contentService) {
         $contentType = $contentTypeService->loadContentType($contentService->loadContent($contentId)->contentInfo->contentTypeId);
         return $contentType;
     });
     return $contentType->identifier;
 }
All Usage Examples Of eZ\Publish\Core\SignalSlot\Repository::getContentTypeService