Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
CopierServiceProvider | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||
__invoke | n/a |
0 / 0 |
n/a |
0 / 0 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; under version 2 |
7 | * of the License (non-upgradable). |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | * |
18 | * Copyright (c) 2022 (original work) Open Assessment Technologies SA. |
19 | * |
20 | * @author Andrei Shapiro <andrei.shapiro@taotesting.com> |
21 | */ |
22 | |
23 | declare(strict_types=1); |
24 | |
25 | namespace oat\tao\model\resources; |
26 | |
27 | use oat\generis\model\data\Ontology; |
28 | use oat\oatbox\event\EventManager; |
29 | use oat\oatbox\filesystem\FileSystemService; |
30 | use oat\tao\model\resources\Service\ClassMover; |
31 | use oat\tao\model\resources\Service\InstanceCopier; |
32 | use oat\tao\model\resources\Service\ClassCopierProxy; |
33 | use oat\tao\model\resources\Service\ClassMetadataMapper; |
34 | use oat\tao\model\resources\Service\ClassMetadataCopier; |
35 | use oat\tao\model\resources\Service\InstanceCopierProxy; |
36 | use oat\tao\model\resources\Service\InstanceMetadataCopier; |
37 | use oat\tao\model\resources\Service\InstanceMover; |
38 | use oat\tao\model\resources\Service\ResourceTransferProxy; |
39 | use oat\tao\model\resources\Service\RootClassesListService; |
40 | use oat\generis\model\fileReference\FileReferenceSerializer; |
41 | use oat\tao\model\resources\Specification\RootClassSpecification; |
42 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
43 | use oat\tao\model\TaoOntology; |
44 | use oat\tao\model\Translation\Service\TranslationMoveService; |
45 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
46 | |
47 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
48 | use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; |
49 | |
50 | /** |
51 | * @codeCoverageIgnore |
52 | */ |
53 | class CopierServiceProvider implements ContainerServiceProviderInterface |
54 | { |
55 | public function __invoke(ContainerConfigurator $configurator): void |
56 | { |
57 | $services = $configurator->services(); |
58 | |
59 | $services->set(ClassMetadataMapper::class, ClassMetadataMapper::class); |
60 | |
61 | $services |
62 | ->set(ClassMetadataCopier::class, ClassMetadataCopier::class) |
63 | ->share(false) |
64 | ->args( |
65 | [ |
66 | service(ClassMetadataMapper::class), |
67 | ] |
68 | ); |
69 | |
70 | $services |
71 | ->set(InstanceMetadataCopier::class, InstanceMetadataCopier::class) |
72 | ->share(false) |
73 | ->args( |
74 | [ |
75 | service(ClassMetadataMapper::class), |
76 | service(FileReferenceSerializer::SERVICE_ID), |
77 | service(FileSystemService::SERVICE_ID), |
78 | [ |
79 | TaoOntology::PROPERTY_LANGUAGE, |
80 | TaoOntology::PROPERTY_TRANSLATION_STATUS, |
81 | TaoOntology::PROPERTY_TRANSLATION_TYPE |
82 | ] |
83 | ] |
84 | ); |
85 | |
86 | $services |
87 | ->get(InstanceMetadataCopier::class) |
88 | ->call( |
89 | 'addPropertyUrisToBlacklist', |
90 | [ |
91 | [ |
92 | TaoOntology::PROPERTY_UNIQUE_IDENTIFIER, |
93 | ] |
94 | ] |
95 | ); |
96 | |
97 | $services |
98 | ->set(InstanceCopier::class, InstanceCopier::class) |
99 | ->args( |
100 | [ |
101 | service(InstanceMetadataCopier::class), |
102 | service(Ontology::SERVICE_ID) |
103 | ] |
104 | ); |
105 | |
106 | $services |
107 | ->set(ClassCopierProxy::class, ClassCopierProxy::class) |
108 | ->share(false) |
109 | ->public() |
110 | ->args( |
111 | [ |
112 | service(RootClassesListService::class), |
113 | service(Ontology::SERVICE_ID), |
114 | ] |
115 | ); |
116 | |
117 | $services |
118 | ->set(InstanceCopierProxy::class, InstanceCopierProxy::class) |
119 | ->share(false) |
120 | ->public() |
121 | ->args( |
122 | [ |
123 | service(RootClassesListService::class), |
124 | service(Ontology::SERVICE_ID), |
125 | ] |
126 | ); |
127 | |
128 | $services |
129 | ->set(ClassMover::class, ClassMover::class) |
130 | ->share(false) |
131 | ->args( |
132 | [ |
133 | service(Ontology::SERVICE_ID), |
134 | service(RootClassSpecification::class), |
135 | service(RootClassesListService::class), |
136 | service(EventManager::SERVICE_ID) |
137 | ] |
138 | ) |
139 | ->call( |
140 | 'withPermissionCopiers', |
141 | [ |
142 | tagged_iterator('tao.copier.permissions'), |
143 | ] |
144 | ); |
145 | |
146 | $services |
147 | ->set(InstanceMover::class, InstanceMover::class) |
148 | ->args( |
149 | [ |
150 | service(Ontology::SERVICE_ID), |
151 | service(RootClassesListService::class), |
152 | service(TranslationMoveService::class), |
153 | ] |
154 | ) |
155 | ->call( |
156 | 'withPermissionCopiers', |
157 | [ |
158 | tagged_iterator('tao.copier.permissions'), |
159 | ] |
160 | ); |
161 | |
162 | $services |
163 | ->set(ResourceTransferProxy::class, ResourceTransferProxy::class) |
164 | ->share(false) |
165 | ->public() |
166 | ->args( |
167 | [ |
168 | service(ClassCopierProxy::class), |
169 | service(InstanceCopierProxy::class), |
170 | service(ClassMover::class), |
171 | service(InstanceMover::class), |
172 | service(Ontology::SERVICE_ID), |
173 | ] |
174 | ); |
175 | } |
176 | } |