1 | <?php |
||
28 | class Legacy extends SetupFactory |
||
29 | { |
||
30 | /** |
||
31 | * Data source name. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected static $dsn; |
||
36 | |||
37 | /** |
||
38 | * Root dir for IO operations. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected static $ioRootDir; |
||
43 | |||
44 | /** |
||
45 | * Database type (sqlite, mysql, ...). |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected static $db; |
||
50 | |||
51 | /** |
||
52 | * Service container. |
||
53 | * |
||
54 | * @var \eZ\Publish\Core\Base\ServiceContainer |
||
55 | */ |
||
56 | protected static $serviceContainer; |
||
57 | |||
58 | /** |
||
59 | * If the DB schema has already been initialized. |
||
60 | * |
||
61 | * @var bool |
||
62 | */ |
||
63 | protected static $schemaInitialized = false; |
||
64 | |||
65 | /** |
||
66 | * Initial database data. |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected static $initialData; |
||
71 | |||
72 | protected $repositoryReference = 'ezpublish.api.repository'; |
||
73 | |||
74 | /** |
||
75 | * Creates a new setup factory. |
||
76 | */ |
||
77 | public function __construct() |
||
90 | |||
91 | /** |
||
92 | * Creates a temporary directory and returns it. |
||
93 | * |
||
94 | * @return string |
||
95 | * @throw \RuntimeException If the root directory can't be created |
||
96 | */ |
||
97 | private function createTemporaryDirectory() |
||
116 | |||
117 | /** |
||
118 | * Returns a configured repository for testing. |
||
119 | * |
||
120 | * @param bool $initializeFromScratch if the back end should be initialized |
||
121 | * from scratch or re-used |
||
122 | * |
||
123 | * @return \eZ\Publish\API\Repository\Repository |
||
124 | */ |
||
125 | public function getRepository($initializeFromScratch = true) |
||
140 | |||
141 | /** |
||
142 | * Returns a config value for $configKey. |
||
143 | * |
||
144 | * @param string $configKey |
||
145 | * |
||
146 | * @throws Exception if $configKey could not be found. |
||
147 | * |
||
148 | * @return mixed |
||
149 | */ |
||
150 | public function getConfigValue($configKey) |
||
154 | |||
155 | /** |
||
156 | * Returns a repository specific ID manager. |
||
157 | * |
||
158 | * @return \eZ\Publish\API\Repository\Tests\IdManager |
||
159 | */ |
||
160 | public function getIdManager() |
||
164 | |||
165 | /** |
||
166 | * Insert the database data. |
||
167 | */ |
||
168 | public function insertData() |
||
234 | |||
235 | protected function getInitialVarDir() |
||
239 | |||
240 | protected function cleanupVarDir($sourceDir) |
||
250 | |||
251 | /** |
||
252 | * CLears internal in memory caches after inserting data circumventing the |
||
253 | * API. |
||
254 | */ |
||
255 | protected function clearInternalCaches() |
||
275 | |||
276 | /** |
||
277 | * Returns statements to be executed after data insert. |
||
278 | * |
||
279 | * @return string[] |
||
280 | */ |
||
281 | protected function getPostInsertStatements() |
||
291 | |||
292 | /** |
||
293 | * Returns the initial database data. |
||
294 | * |
||
295 | * @return array |
||
296 | */ |
||
297 | protected function getInitialData() |
||
306 | |||
307 | /** |
||
308 | * Initializes the database schema. |
||
309 | */ |
||
310 | protected function initializeSchema() |
||
320 | |||
321 | /** |
||
322 | * Applies the given SQL $statements to the database in use. |
||
323 | * |
||
324 | * @param array $statements |
||
325 | */ |
||
326 | protected function applyStatements(array $statements) |
||
332 | |||
333 | // ************* Setup copied and refactored from common.php ************ |
||
334 | |||
335 | /** |
||
336 | * Returns the database schema as an array of SQL statements. |
||
337 | * |
||
338 | * @return string[] |
||
339 | */ |
||
340 | protected function getSchemaStatements() |
||
346 | |||
347 | /** |
||
348 | * Returns the database handler from the service container. |
||
349 | * |
||
350 | * @return \eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler |
||
351 | */ |
||
352 | protected function getDatabaseHandler() |
||
356 | |||
357 | /** |
||
358 | * Returns the service container used for initialization of the repository. |
||
359 | * |
||
360 | * @return \eZ\Publish\Core\Base\ServiceContainer |
||
361 | */ |
||
362 | public function getServiceContainer() |
||
401 | |||
402 | /** |
||
403 | * This is intended to be used from external repository in order to |
||
404 | * enable container customization. |
||
405 | * |
||
406 | * @param \Symfony\Component\DependencyInjection\ContainerBuilder $containerBuilder |
||
407 | */ |
||
408 | protected function externalBuildContainer(ContainerBuilder $containerBuilder) |
||
412 | |||
413 | /** |
||
414 | * Get the Database name. |
||
415 | * |
||
416 | * @return string |
||
417 | */ |
||
418 | public function getDB() |
||
422 | } |
||
423 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.