Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\ApiLoader;
8
9 use eZ\Publish\Core\MVC\ConfigResolverInterface;
10 use eZ\Publish\Core\Repository\Helper\RelationProcessor;
11 use eZ\Publish\Core\Repository\Values\User\UserReference;
12 use eZ\Publish\Core\Search\Common\BackgroundIndexer;
13 use eZ\Publish\SPI\Persistence\Handler as PersistenceHandler;
14 use eZ\Publish\SPI\Search\Handler as SearchHandler;
15 use eZ\Publish\SPI\Limitation\Type as SPILimitationType;
16 use eZ\Publish\Core\Base\Container\ApiLoader\FieldTypeCollectionFactory;
17 use eZ\Publish\Core\Base\Container\ApiLoader\FieldTypeNameableCollectionFactory;
18 use Psr\Log\LoggerInterface;
19 use Psr\Log\NullLogger;
20 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
21 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
22
23 class RepositoryFactory implements ContainerAwareInterface
24 {
25 use ContainerAwareTrait;
26
28 private $configResolver;
29
35 protected $fieldTypeCollectionFactory;
36
42 protected $fieldTypeNameableCollectionFactory;
43
45 private $repositoryClass;
46
52 protected $roleLimitations = [];
53
59 private $policyMap;
60
62 private $logger;
63
64 public function __construct(
65 ConfigResolverInterface $configResolver,
66 FieldTypeCollectionFactory $fieldTypeCollectionFactory,
67 FieldTypeNameableCollectionFactory $fieldTypeNameableCollectionFactory,
68 $repositoryClass,
69 array $policyMap,
70 LoggerInterface $logger = null
71 ) {
72 $this->configResolver = $configResolver;
73 $this->fieldTypeCollectionFactory = $fieldTypeCollectionFactory;
74 $this->fieldTypeNameableCollectionFactory = $fieldTypeNameableCollectionFactory;
75 $this->repositoryClass = $repositoryClass;
76 $this->policyMap = $policyMap;
77 $this->logger = null !== $logger ? $logger : new NullLogger();
78 }
79
93 public function buildRepository(
94 PersistenceHandler $persistenceHandler,
95 SearchHandler $searchHandler,
96 BackgroundIndexer $backgroundIndexer,
97 RelationProcessor $relationProcessor
98 ) {
99 $config = $this->container->get('ezpublish.api.repository_configuration_provider')->getRepositoryConfig();
100
101 $repository = new $this->repositoryClass(
102 $persistenceHandler,
103 $searchHandler,
104 $backgroundIndexer,
105 $relationProcessor,
106 [
107 'fieldType' => $this->fieldTypeCollectionFactory->getFieldTypes(),
108 'nameableFieldTypes' => $this->fieldTypeNameableCollectionFactory->getNameableFieldTypes(),
109 'role' => [
110 'limitationTypes' => $this->roleLimitations,
111 'policyMap' => $this->policyMap,
112 ],
113 'languages' => $this->configResolver->getParameter('languages'),
114 'content' => [
115 'default_version_archive_limit' => $config['options']['default_version_archive_limit'],
116 'remove_archived_versions_on_publish' => $config['options']['remove_archived_versions_on_publish'],
117 ],
118 ],
119 new UserReference($this->configResolver->getParameter('anonymous_user_id')),
120 $this->logger
121 );
122
123 return $repository;
124 }
125
132 public function registerLimitationType($limitationName, SPILimitationType $limitationType)
133 {
134 $this->roleLimitations[$limitationName] = $limitationType;
135 }
136 }
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:24
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\$repositoryClass
$repositoryClass
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:45
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\$fieldTypeNameableCollectionFactory
$fieldTypeNameableCollectionFactory
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:42
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\$fieldTypeCollectionFactory
$fieldTypeCollectionFactory
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:35
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\__construct
__construct(ConfigResolverInterface $configResolver, FieldTypeCollectionFactory $fieldTypeCollectionFactory, FieldTypeNameableCollectionFactory $fieldTypeNameableCollectionFactory, $repositoryClass, array $policyMap, LoggerInterface $logger=null)
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:64
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\registerLimitationType
registerLimitationType($limitationName, SPILimitationType $limitationType)
Registers a limitation type for the RoleService.
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:132
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\$logger
$logger
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:62
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\$roleLimitations
$roleLimitations
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:52
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\$policyMap
$policyMap
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:59
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\buildRepository
buildRepository(PersistenceHandler $persistenceHandler, SearchHandler $searchHandler, BackgroundIndexer $backgroundIndexer, RelationProcessor $relationProcessor)
Builds the main repository, heart of eZ Publish API.
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:93
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryFactory\$configResolver
$configResolver
Definition: Bundle/EzPublishCoreBundle/ApiLoader/RepositoryFactory.php:28
eZ\Publish\Core\Base\Container\ApiLoader\FieldTypeCollectionFactory
Definition: FieldTypeCollectionFactory.php:13
eZ\Publish\Core\Base\Container\ApiLoader\FieldTypeNameableCollectionFactory
Definition: FieldTypeNameableCollectionFactory.php:14
eZ\Publish\Core\Repository\Helper\RelationProcessor
RelationProcessor is an internal service used for handling field relations upon Content creation or u...
Definition: Repository/Helper/RelationProcessor.php:25
eZ\Publish\Core\Repository\Values\User\UserReference
This class represents a user reference for use in sessions and Repository.
Definition: Core/Repository/Values/User/UserReference.php:17
eZ\Publish\Core\MVC\ConfigResolverInterface
Interface for config resolvers.
Definition: ConfigResolverInterface.php:19
eZ\Publish\Core\Search\Common\BackgroundIndexer
Interface for performing indexing in background.
Definition: BackgroundIndexer.php:21
eZ\Publish\SPI\Limitation\Type
This interface represent the Limitation Type.
Definition: SPI/Limitation/Type.php:22
eZ\Publish\SPI\Persistence\Handler
The main handler for Storage Engine.
Definition: SPI/Persistence/Handler.php:15
eZ\Publish\SPI\Search\Handler
The Search handler retrieves sets of of Content objects, based on a set of criteria.
Definition: SPI/Search/Handler.php:20
eZ\Bundle\EzPublishCoreBundle\ApiLoader
Definition: CacheFactory.php:7
eZ\Publish\Core\Search\Common\BackgroundIndexer
Definition: NullIndexer.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.