vendor/ezsystems/ezplatform-kernel/eZ/Publish/Core/Repository/Repository.php line 56

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. declare(strict_types=1);
  7. namespace eZ\Publish\Core\Repository;
  8. use eZ\Publish\API\Repository\LanguageResolver;
  9. use eZ\Publish\API\Repository\PermissionCriterionResolver as PermissionCriterionResolverInterface;
  10. use eZ\Publish\API\Repository\PermissionService;
  11. use eZ\Publish\API\Repository\Repository as RepositoryInterface;
  12. use eZ\Publish\API\Repository\NotificationService as NotificationServiceInterface;
  13. use eZ\Publish\API\Repository\BookmarkService as BookmarkServiceInterface;
  14. use eZ\Publish\API\Repository\ContentService as ContentServiceInterface;
  15. use eZ\Publish\API\Repository\ContentTypeService as ContentTypeServiceInterface;
  16. use eZ\Publish\API\Repository\FieldTypeService as FieldTypeServiceInterface;
  17. use eZ\Publish\API\Repository\LanguageService as LanguageServiceInterface;
  18. use eZ\Publish\API\Repository\LocationService as LocationServiceInterface;
  19. use eZ\Publish\API\Repository\ObjectStateService as ObjectStateServiceInterface;
  20. use eZ\Publish\API\Repository\PermissionResolver as PermissionResolverInterface;
  21. use eZ\Publish\API\Repository\RoleService as RoleServiceInterface;
  22. use eZ\Publish\API\Repository\SearchService as SearchServiceInterface;
  23. use eZ\Publish\API\Repository\SectionService as SectionServiceInterface;
  24. use eZ\Publish\API\Repository\TrashService as TrashServiceInterface;
  25. use eZ\Publish\API\Repository\URLAliasService as URLAliasServiceInterface;
  26. use eZ\Publish\API\Repository\URLService as URLServiceInterface;
  27. use eZ\Publish\API\Repository\URLWildcardService as URLWildcardServiceInterface;
  28. use eZ\Publish\API\Repository\UserPreferenceService as UserPreferenceServiceInterface;
  29. use eZ\Publish\API\Repository\UserService as UserServiceInterface;
  30. use eZ\Publish\API\Repository\PasswordHashService;
  31. use eZ\Publish\Core\FieldType\FieldTypeRegistry;
  32. use eZ\Publish\Core\Repository\Helper\NameSchemaService;
  33. use eZ\Publish\Core\Repository\Permission\LimitationService;
  34. use eZ\Publish\Core\Repository\ProxyFactory\ProxyDomainMapperFactoryInterface;
  35. use eZ\Publish\Core\Repository\ProxyFactory\ProxyDomainMapperInterface;
  36. use eZ\Publish\Core\Repository\Helper\RelationProcessor;
  37. use eZ\Publish\Core\Repository\User\PasswordValidatorInterface;
  38. use eZ\Publish\Core\Search\Common\BackgroundIndexer;
  39. use eZ\Publish\SPI\Persistence\Filter\Content\Handler as ContentFilteringHandler;
  40. use eZ\Publish\SPI\Persistence\Filter\Location\Handler as LocationFilteringHandler;
  41. use eZ\Publish\SPI\Persistence\Handler as PersistenceHandler;
  42. use eZ\Publish\SPI\Repository\Strategy\ContentThumbnail\ThumbnailStrategy;
  43. use eZ\Publish\SPI\Repository\Validator\ContentValidator;
  44. use eZ\Publish\SPI\Search\Handler as SearchHandler;
  45. use Exception;
  46. use Psr\Log\LoggerInterface;
  47. use Psr\Log\NullLogger;
  48. use RuntimeException;
  49. /**
  50.  * Repository class.
  51.  */
  52. class Repository implements RepositoryInterface
  53. {
  54.     /**
  55.      * Repository Handler object.
  56.      *
  57.      * @var \eZ\Publish\SPI\Persistence\Handler
  58.      */
  59.     protected $persistenceHandler;
  60.     /**
  61.      * Instance of main Search Handler.
  62.      *
  63.      * @var \eZ\Publish\SPI\Search\Handler
  64.      */
  65.     protected $searchHandler;
  66.     /**
  67.      * Instance of content service.
  68.      *
  69.      * @var \eZ\Publish\API\Repository\ContentService
  70.      */
  71.     protected $contentService;
  72.     /**
  73.      * Instance of section service.
  74.      *
  75.      * @var \eZ\Publish\API\Repository\SectionService
  76.      */
  77.     protected $sectionService;
  78.     /**
  79.      * Instance of role service.
  80.      *
  81.      * @var \eZ\Publish\API\Repository\RoleService
  82.      */
  83.     protected $roleService;
  84.     /**
  85.      * Instance of search service.
  86.      *
  87.      * @var \eZ\Publish\API\Repository\SearchService
  88.      */
  89.     protected $searchService;
  90.     /**
  91.      * Instance of user service.
  92.      *
  93.      * @var \eZ\Publish\API\Repository\UserService
  94.      */
  95.     protected $userService;
  96.     /**
  97.      * Instance of language service.
  98.      *
  99.      * @var \eZ\Publish\API\Repository\LanguageService
  100.      */
  101.     protected $languageService;
  102.     /**
  103.      * Instance of location service.
  104.      *
  105.      * @var \eZ\Publish\API\Repository\LocationService
  106.      */
  107.     protected $locationService;
  108.     /**
  109.      * Instance of Trash service.
  110.      *
  111.      * @var \eZ\Publish\API\Repository\TrashService
  112.      */
  113.     protected $trashService;
  114.     /**
  115.      * Instance of content type service.
  116.      *
  117.      * @var \eZ\Publish\API\Repository\ContentTypeService
  118.      */
  119.     protected $contentTypeService;
  120.     /**
  121.      * Instance of object state service.
  122.      *
  123.      * @var \eZ\Publish\API\Repository\ObjectStateService
  124.      */
  125.     protected $objectStateService;
  126.     /**
  127.      * Instance of field type service.
  128.      *
  129.      * @var \eZ\Publish\API\Repository\FieldTypeService
  130.      */
  131.     protected $fieldTypeService;
  132.     /** @var \eZ\Publish\Core\FieldType\FieldTypeRegistry */
  133.     private $fieldTypeRegistry;
  134.     /**
  135.      * Instance of name schema resolver service.
  136.      *
  137.      * @var \eZ\Publish\Core\Repository\Helper\NameSchemaService
  138.      */
  139.     protected $nameSchemaService;
  140.     /**
  141.      * Instance of relation processor service.
  142.      *
  143.      * @var \eZ\Publish\Core\Repository\Helper\RelationProcessor
  144.      */
  145.     protected $relationProcessor;
  146.     /**
  147.      * Instance of URL alias service.
  148.      *
  149.      * @var \eZ\Publish\Core\Repository\URLAliasService
  150.      */
  151.     protected $urlAliasService;
  152.     /**
  153.      * Instance of URL wildcard service.
  154.      *
  155.      * @var \eZ\Publish\Core\Repository\URLWildcardService
  156.      */
  157.     protected $urlWildcardService;
  158.     /**
  159.      * Instance of URL service.
  160.      *
  161.      * @var \eZ\Publish\Core\Repository\URLService
  162.      */
  163.     protected $urlService;
  164.     /**
  165.      * Instance of Bookmark service.
  166.      *
  167.      * @var \eZ\Publish\API\Repository\BookmarkService
  168.      */
  169.     protected $bookmarkService;
  170.     /**
  171.      * Instance of Notification service.
  172.      *
  173.      * @var \eZ\Publish\API\Repository\NotificationService
  174.      */
  175.     protected $notificationService;
  176.     /**
  177.      * Instance of User Preference service.
  178.      *
  179.      * @var \eZ\Publish\API\Repository\UserPreferenceService
  180.      */
  181.     protected $userPreferenceService;
  182.     /**
  183.      * Service settings, first level key is service name.
  184.      *
  185.      * @var array
  186.      */
  187.     protected $serviceSettings;
  188.     /** @var \eZ\Publish\Core\Repository\Permission\LimitationService */
  189.     protected $limitationService;
  190.     /** @var \eZ\Publish\Core\Repository\Mapper\RoleDomainMapper */
  191.     protected $roleDomainMapper;
  192.     /** @var \eZ\Publish\Core\Repository\Mapper\ContentDomainMapper */
  193.     protected $contentDomainMapper;
  194.     /** @var \eZ\Publish\Core\Repository\Mapper\ContentTypeDomainMapper */
  195.     protected $contentTypeDomainMapper;
  196.     /** @var \eZ\Publish\Core\Search\Common\BackgroundIndexer|null */
  197.     protected $backgroundIndexer;
  198.     /** @var \Psr\Log\LoggerInterface */
  199.     private $logger;
  200.     /** @var \eZ\Publish\API\Repository\PasswordHashService */
  201.     private $passwordHashService;
  202.     /** @var \eZ\Publish\SPI\Repository\Strategy\ContentThumbnail\ThumbnailStrategy */
  203.     private $thumbnailStrategy;
  204.     /** @var \eZ\Publish\Core\Repository\ProxyFactory\ProxyDomainMapperFactory */
  205.     private $proxyDomainMapperFactory;
  206.     /** @var \eZ\Publish\Core\Repository\ProxyFactory\ProxyDomainMapperInterface|null */
  207.     private $proxyDomainMapper;
  208.     /** @var \eZ\Publish\API\Repository\LanguageResolver */
  209.     private $languageResolver;
  210.     /** @var \eZ\Publish\API\Repository\PermissionService */
  211.     private $permissionService;
  212.     /** @var \eZ\Publish\Core\Repository\Mapper\ContentMapper */
  213.     private $contentMapper;
  214.     /** @var \eZ\Publish\SPI\Repository\Validator\ContentValidator */
  215.     private $contentValidator;
  216.     /** @var \eZ\Publish\SPI\Persistence\Filter\Content\Handler */
  217.     private $contentFilteringHandler;
  218.     /** @var \eZ\Publish\SPI\Persistence\Filter\Location\Handler */
  219.     private $locationFilteringHandler;
  220.     /** @var PasswordValidatorInterface */
  221.     private $passwordValidator;
  222.     public function __construct(
  223.         PersistenceHandler $persistenceHandler,
  224.         SearchHandler $searchHandler,
  225.         BackgroundIndexer $backgroundIndexer,
  226.         RelationProcessor $relationProcessor,
  227.         FieldTypeRegistry $fieldTypeRegistry,
  228.         PasswordHashService $passwordHashGenerator,
  229.         ThumbnailStrategy $thumbnailStrategy,
  230.         ProxyDomainMapperFactoryInterface $proxyDomainMapperFactory,
  231.         Mapper\ContentDomainMapper $contentDomainMapper,
  232.         Mapper\ContentTypeDomainMapper $contentTypeDomainMapper,
  233.         Mapper\RoleDomainMapper $roleDomainMapper,
  234.         Mapper\ContentMapper $contentMapper,
  235.         ContentValidator $contentValidator,
  236.         LimitationService $limitationService,
  237.         LanguageResolver $languageResolver,
  238.         PermissionService $permissionService,
  239.         ContentFilteringHandler $contentFilteringHandler,
  240.         LocationFilteringHandler $locationFilteringHandler,
  241.         PasswordValidatorInterface $passwordValidator,
  242.         array $serviceSettings = [],
  243.         ?LoggerInterface $logger null
  244.     ) {
  245.         $this->persistenceHandler $persistenceHandler;
  246.         $this->searchHandler $searchHandler;
  247.         $this->backgroundIndexer $backgroundIndexer;
  248.         $this->relationProcessor $relationProcessor;
  249.         $this->fieldTypeRegistry $fieldTypeRegistry;
  250.         $this->passwordHashService $passwordHashGenerator;
  251.         $this->thumbnailStrategy $thumbnailStrategy;
  252.         $this->proxyDomainMapperFactory $proxyDomainMapperFactory;
  253.         $this->contentDomainMapper $contentDomainMapper;
  254.         $this->contentTypeDomainMapper $contentTypeDomainMapper;
  255.         $this->roleDomainMapper $roleDomainMapper;
  256.         $this->limitationService $limitationService;
  257.         $this->languageResolver $languageResolver;
  258.         $this->contentFilteringHandler $contentFilteringHandler;
  259.         $this->permissionService $permissionService;
  260.         $this->locationFilteringHandler $locationFilteringHandler;
  261.         $this->serviceSettings $serviceSettings + [
  262.                 'content' => [],
  263.                 'contentType' => [],
  264.                 'location' => [],
  265.                 'section' => [],
  266.                 'role' => [],
  267.                 'user' => [
  268.                     'anonymousUserID' => 10,
  269.                 ],
  270.                 'language' => [],
  271.                 'trash' => [],
  272.                 'io' => [],
  273.                 'objectState' => [],
  274.                 'search' => [],
  275.                 'urlAlias' => [],
  276.                 'urlWildcard' => [],
  277.                 'nameSchema' => [],
  278.                 'languages' => [],
  279.                 'proxy_factory' => [],
  280.             ];
  281.         if (!empty($this->serviceSettings['languages'])) {
  282.             $this->serviceSettings['language']['languages'] = $this->serviceSettings['languages'];
  283.         }
  284.         $this->logger null !== $logger $logger : new NullLogger();
  285.         $this->contentMapper $contentMapper;
  286.         $this->contentValidator $contentValidator;
  287.         $this->passwordValidator $passwordValidator;
  288.     }
  289.     /**
  290.      * {@inheritdoc}
  291.      */
  292.     public function sudo(callable $callback, ?RepositoryInterface $outerRepository null)
  293.     {
  294.         return $this->getPermissionResolver()->sudo($callback$outerRepository ?? $this);
  295.     }
  296.     /**
  297.      * Get Content Service.
  298.      *
  299.      * Get service object to perform operations on Content objects and it's aggregate members.
  300.      *
  301.      * @return \eZ\Publish\API\Repository\ContentService
  302.      */
  303.     public function getContentService(): ContentServiceInterface
  304.     {
  305.         if ($this->contentService !== null) {
  306.             return $this->contentService;
  307.         }
  308.         $this->contentService = new ContentService(
  309.             $this,
  310.             $this->persistenceHandler,
  311.             $this->contentDomainMapper,
  312.             $this->getRelationProcessor(),
  313.             $this->getNameSchemaService(),
  314.             $this->fieldTypeRegistry,
  315.             $this->getPermissionService(),
  316.             $this->contentMapper,
  317.             $this->contentValidator,
  318.             $this->contentFilteringHandler,
  319.             $this->serviceSettings['content'],
  320.         );
  321.         return $this->contentService;
  322.     }
  323.     /**
  324.      * Get Content Language Service.
  325.      *
  326.      * Get service object to perform operations on Content language objects
  327.      *
  328.      * @return \eZ\Publish\API\Repository\LanguageService
  329.      */
  330.     public function getContentLanguageService(): LanguageServiceInterface
  331.     {
  332.         if ($this->languageService !== null) {
  333.             return $this->languageService;
  334.         }
  335.         $this->languageService = new LanguageService(
  336.             $this,
  337.             $this->persistenceHandler->contentLanguageHandler(),
  338.             $this->getPermissionResolver(),
  339.             $this->serviceSettings['language']
  340.         );
  341.         return $this->languageService;
  342.     }
  343.     /**
  344.      * Get Content Type Service.
  345.      *
  346.      * Get service object to perform operations on Content Type objects and it's aggregate members.
  347.      * ( Group, Field & FieldCategory )
  348.      *
  349.      * @return \eZ\Publish\API\Repository\ContentTypeService
  350.      */
  351.     public function getContentTypeService(): ContentTypeServiceInterface
  352.     {
  353.         if ($this->contentTypeService !== null) {
  354.             return $this->contentTypeService;
  355.         }
  356.         $this->contentTypeService = new ContentTypeService(
  357.             $this,
  358.             $this->persistenceHandler->contentTypeHandler(),
  359.             $this->persistenceHandler->userHandler(),
  360.             $this->contentDomainMapper,
  361.             $this->contentTypeDomainMapper,
  362.             $this->fieldTypeRegistry,
  363.             $this->getPermissionResolver(),
  364.             $this->serviceSettings['contentType']
  365.         );
  366.         return $this->contentTypeService;
  367.     }
  368.     /**
  369.      * Get Content Location Service.
  370.      *
  371.      * Get service object to perform operations on Location objects and subtrees
  372.      *
  373.      * @return \eZ\Publish\API\Repository\LocationService
  374.      */
  375.     public function getLocationService(): LocationServiceInterface
  376.     {
  377.         if ($this->locationService !== null) {
  378.             return $this->locationService;
  379.         }
  380.         $this->locationService = new LocationService(
  381.             $this,
  382.             $this->persistenceHandler,
  383.             $this->contentDomainMapper,
  384.             $this->getNameSchemaService(),
  385.             $this->getPermissionCriterionResolver(),
  386.             $this->getPermissionResolver(),
  387.             $this->locationFilteringHandler,
  388.             $this->getContentTypeService(),
  389.             $this->serviceSettings['location'],
  390.             $this->logger
  391.         );
  392.         return $this->locationService;
  393.     }
  394.     /**
  395.      * Get Content Trash service.
  396.      *
  397.      * Trash service allows to perform operations related to location trash
  398.      * (trash/untrash, load/list from trash...)
  399.      *
  400.      * @return \eZ\Publish\API\Repository\TrashService
  401.      */
  402.     public function getTrashService(): TrashServiceInterface
  403.     {
  404.         if ($this->trashService !== null) {
  405.             return $this->trashService;
  406.         }
  407.         $this->trashService = new TrashService(
  408.             $this,
  409.             $this->persistenceHandler,
  410.             $this->getNameSchemaService(),
  411.             $this->getPermissionCriterionResolver(),
  412.             $this->getPermissionResolver(),
  413.             $this->getProxyDomainMapper(),
  414.             $this->serviceSettings['trash']
  415.         );
  416.         return $this->trashService;
  417.     }
  418.     /**
  419.      * Get Content Section Service.
  420.      *
  421.      * Get Section service that lets you manipulate section objects
  422.      *
  423.      * @return \eZ\Publish\API\Repository\SectionService
  424.      */
  425.     public function getSectionService(): SectionServiceInterface
  426.     {
  427.         if ($this->sectionService !== null) {
  428.             return $this->sectionService;
  429.         }
  430.         $this->sectionService = new SectionService(
  431.             $this,
  432.             $this->persistenceHandler->sectionHandler(),
  433.             $this->persistenceHandler->locationHandler(),
  434.             $this->getPermissionCriterionResolver(),
  435.             $this->serviceSettings['section']
  436.         );
  437.         return $this->sectionService;
  438.     }
  439.     /**
  440.      * Get User Service.
  441.      *
  442.      * Get service object to perform operations on Users and UserGroup
  443.      *
  444.      * @return \eZ\Publish\API\Repository\UserService
  445.      */
  446.     public function getUserService(): UserServiceInterface
  447.     {
  448.         if ($this->userService !== null) {
  449.             return $this->userService;
  450.         }
  451.         $this->userService = new UserService(
  452.             $this,
  453.             $this->getPermissionResolver(),
  454.             $this->persistenceHandler->userHandler(),
  455.             $this->persistenceHandler->locationHandler(),
  456.             $this->passwordHashService,
  457.             $this->passwordValidator,
  458.             $this->serviceSettings['user']
  459.         );
  460.         return $this->userService;
  461.     }
  462.     /**
  463.      * Get URLAliasService.
  464.      *
  465.      * @return \eZ\Publish\API\Repository\URLAliasService
  466.      */
  467.     public function getURLAliasService(): URLAliasServiceInterface
  468.     {
  469.         if ($this->urlAliasService !== null) {
  470.             return $this->urlAliasService;
  471.         }
  472.         $this->urlAliasService = new URLAliasService(
  473.             $this,
  474.             $this->persistenceHandler->urlAliasHandler(),
  475.             $this->getNameSchemaService(),
  476.             $this->getPermissionResolver(),
  477.             $this->languageResolver
  478.         );
  479.         return $this->urlAliasService;
  480.     }
  481.     /**
  482.      * Get URLWildcardService.
  483.      *
  484.      * @return \eZ\Publish\API\Repository\URLWildcardService
  485.      */
  486.     public function getURLWildcardService(): URLWildcardServiceInterface
  487.     {
  488.         if ($this->urlWildcardService !== null) {
  489.             return $this->urlWildcardService;
  490.         }
  491.         $this->urlWildcardService = new URLWildcardService(
  492.             $this,
  493.             $this->persistenceHandler->urlWildcardHandler(),
  494.             $this->getPermissionResolver(),
  495.             $this->serviceSettings['urlWildcard']
  496.         );
  497.         return $this->urlWildcardService;
  498.     }
  499.     /**
  500.      * Get URLService.
  501.      *
  502.      * @return \eZ\Publish\API\Repository\URLService
  503.      */
  504.     public function getURLService(): URLServiceInterface
  505.     {
  506.         if ($this->urlService !== null) {
  507.             return $this->urlService;
  508.         }
  509.         $this->urlService = new URLService(
  510.             $this,
  511.             $this->persistenceHandler->urlHandler(),
  512.             $this->getPermissionResolver()
  513.         );
  514.         return $this->urlService;
  515.     }
  516.     /**
  517.      * Get BookmarkService.
  518.      *
  519.      * @return \eZ\Publish\API\Repository\BookmarkService
  520.      */
  521.     public function getBookmarkService(): BookmarkServiceInterface
  522.     {
  523.         if ($this->bookmarkService === null) {
  524.             $this->bookmarkService = new BookmarkService(
  525.                 $this,
  526.                 $this->persistenceHandler->bookmarkHandler()
  527.             );
  528.         }
  529.         return $this->bookmarkService;
  530.     }
  531.     /**
  532.      * Get UserPreferenceService.
  533.      *
  534.      * @return \eZ\Publish\API\Repository\UserPreferenceService
  535.      */
  536.     public function getUserPreferenceService(): UserPreferenceServiceInterface
  537.     {
  538.         if ($this->userPreferenceService === null) {
  539.             $this->userPreferenceService = new UserPreferenceService(
  540.                 $this,
  541.                 $this->persistenceHandler->userPreferenceHandler()
  542.             );
  543.         }
  544.         return $this->userPreferenceService;
  545.     }
  546.     /**
  547.      * Get ObjectStateService.
  548.      *
  549.      * @return \eZ\Publish\API\Repository\ObjectStateService
  550.      */
  551.     public function getObjectStateService(): ObjectStateServiceInterface
  552.     {
  553.         if ($this->objectStateService !== null) {
  554.             return $this->objectStateService;
  555.         }
  556.         $this->objectStateService = new ObjectStateService(
  557.             $this,
  558.             $this->persistenceHandler->objectStateHandler(),
  559.             $this->getPermissionResolver(),
  560.             $this->serviceSettings['objectState']
  561.         );
  562.         return $this->objectStateService;
  563.     }
  564.     /**
  565.      * Get RoleService.
  566.      *
  567.      * @return \eZ\Publish\API\Repository\RoleService
  568.      */
  569.     public function getRoleService(): RoleServiceInterface
  570.     {
  571.         if ($this->roleService !== null) {
  572.             return $this->roleService;
  573.         }
  574.         $this->roleService = new RoleService(
  575.             $this,
  576.             $this->persistenceHandler->userHandler(),
  577.             $this->limitationService,
  578.             $this->getRoleDomainMapper(),
  579.             $this->serviceSettings['role']
  580.         );
  581.         return $this->roleService;
  582.     }
  583.     protected function getRoleDomainMapper(): Mapper\RoleDomainMapper
  584.     {
  585.         return $this->roleDomainMapper;
  586.     }
  587.     /**
  588.      * Get SearchService.
  589.      *
  590.      * @return \eZ\Publish\API\Repository\SearchService
  591.      */
  592.     public function getSearchService(): SearchServiceInterface
  593.     {
  594.         if ($this->searchService !== null) {
  595.             return $this->searchService;
  596.         }
  597.         $this->searchService = new SearchService(
  598.             $this,
  599.             $this->searchHandler,
  600.             $this->contentDomainMapper,
  601.             $this->getPermissionCriterionResolver(),
  602.             $this->backgroundIndexer,
  603.             $this->serviceSettings['search']
  604.         );
  605.         return $this->searchService;
  606.     }
  607.     /**
  608.      * Get FieldTypeService.
  609.      *
  610.      * @return \eZ\Publish\API\Repository\FieldTypeService
  611.      */
  612.     public function getFieldTypeService(): FieldTypeServiceInterface
  613.     {
  614.         if ($this->fieldTypeService !== null) {
  615.             return $this->fieldTypeService;
  616.         }
  617.         $this->fieldTypeService = new FieldTypeService($this->fieldTypeRegistry);
  618.         return $this->fieldTypeService;
  619.     }
  620.     public function getPermissionService(): PermissionService
  621.     {
  622.         return $this->permissionService;
  623.     }
  624.     public function getPermissionResolver(): PermissionResolverInterface
  625.     {
  626.         return $this->getPermissionService();
  627.     }
  628.     /**
  629.      * Get NameSchemaResolverService.
  630.      *
  631.      *
  632.      * @todo Move out from this & other repo instances when services becomes proper services in DIC terms using factory.
  633.      *
  634.      * @internal
  635.      * @private
  636.      *
  637.      * @return \eZ\Publish\Core\Repository\Helper\NameSchemaService
  638.      */
  639.     public function getNameSchemaService(): NameSchemaService
  640.     {
  641.         if ($this->nameSchemaService !== null) {
  642.             return $this->nameSchemaService;
  643.         }
  644.         $this->nameSchemaService = new Helper\NameSchemaService(
  645.             $this->persistenceHandler->contentTypeHandler(),
  646.             $this->contentTypeDomainMapper,
  647.             $this->fieldTypeRegistry,
  648.             $this->serviceSettings['nameSchema']
  649.         );
  650.         return $this->nameSchemaService;
  651.     }
  652.     /**
  653.      * @return \eZ\Publish\API\Repository\NotificationService
  654.      */
  655.     public function getNotificationService(): NotificationServiceInterface
  656.     {
  657.         if (null !== $this->notificationService) {
  658.             return $this->notificationService;
  659.         }
  660.         $this->notificationService = new NotificationService(
  661.             $this->persistenceHandler->notificationHandler(),
  662.             $this->getPermissionResolver()
  663.         );
  664.         return $this->notificationService;
  665.     }
  666.     /**
  667.      * Get RelationProcessor.
  668.      *
  669.      *
  670.      * @todo Move out from this & other repo instances when services becomes proper services in DIC terms using factory.
  671.      *
  672.      * @return \eZ\Publish\Core\Repository\Helper\RelationProcessor
  673.      */
  674.     protected function getRelationProcessor(): RelationProcessor
  675.     {
  676.         return $this->relationProcessor;
  677.     }
  678.     protected function getProxyDomainMapper(): ProxyDomainMapperInterface
  679.     {
  680.         if ($this->proxyDomainMapper !== null) {
  681.             return $this->proxyDomainMapper;
  682.         }
  683.         $this->proxyDomainMapper $this->proxyDomainMapperFactory->create($this);
  684.         return $this->proxyDomainMapper;
  685.     }
  686.     protected function getPermissionCriterionResolver(): PermissionCriterionResolverInterface
  687.     {
  688.         return $this->getPermissionService();
  689.     }
  690.     /**
  691.      * Begin transaction.
  692.      *
  693.      * Begins an transaction, make sure you'll call commit or rollback when done,
  694.      * otherwise work will be lost.
  695.      */
  696.     public function beginTransaction(): void
  697.     {
  698.         $this->persistenceHandler->beginTransaction();
  699.     }
  700.     /**
  701.      * Commit transaction.
  702.      *
  703.      * Commit transaction, or throw exceptions if no transactions has been started.
  704.      *
  705.      * @throws \RuntimeException If no transaction has been started
  706.      */
  707.     public function commit(): void
  708.     {
  709.         try {
  710.             $this->persistenceHandler->commit();
  711.         } catch (Exception $e) {
  712.             throw new RuntimeException($e->getMessage(), 0$e);
  713.         }
  714.     }
  715.     /**
  716.      * Rollback transaction.
  717.      *
  718.      * Rollback transaction, or throw exceptions if no transactions has been started.
  719.      *
  720.      * @throws \RuntimeException If no transaction has been started
  721.      */
  722.     public function rollback(): void
  723.     {
  724.         try {
  725.             $this->persistenceHandler->rollback();
  726.         } catch (Exception $e) {
  727.             throw new RuntimeException($e->getMessage(), 0$e);
  728.         }
  729.     }
  730. }