@@ -90,6 +90,9 @@ |
||
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $fileName |
|
| 95 | + */ |
|
| 93 | 96 | protected function getClassNameFromFile($fileName) |
| 94 | 97 | { |
| 95 | 98 | $parts = explode('_', pathinfo($fileName, PATHINFO_FILENAME), 2); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @param $object |
| 69 | - * @return mixed |
|
| 69 | + * @return false|null |
|
| 70 | 70 | */ |
| 71 | 71 | protected function setReferences($object) |
| 72 | 72 | { |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | * @param TagMatcher $tagMatcher |
| 22 | 22 | * @param \Netgen\TagsBundle\Core\SignalSlot\TagsService $tagService |
| 23 | 23 | */ |
| 24 | - public function __construct(TagMatcher $tagMatcher, $tagService=null) |
|
| 24 | + public function __construct(TagMatcher $tagMatcher, $tagService = null) |
|
| 25 | 25 | { |
| 26 | 26 | $this->tagMatcher = $tagMatcher; |
| 27 | 27 | $this->tagService = $tagService; |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Kaliop\eZMigrationBundle\Core\Executor; |
| 4 | 4 | |
| 5 | -use Kaliop\eZMigrationBundle\Core\ReferenceResolver\ReferenceHandler; |
|
| 6 | 5 | use Kaliop\eZMigrationBundle\Core\Matcher\TagMatcher; |
| 7 | 6 | use Kaliop\eZMigrationBundle\API\Collection\TagCollection; |
| 8 | 7 | |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | use Kaliop\eZMigrationBundle\API\MigrationInterface; |
| 4 | - |
|
| 5 | 4 | use Symfony\Component\DependencyInjection\ContainerInterface; |
| 6 | 5 | use Kaliop\eZMigrationBundle\API\Value\Migration; |
| 7 | 6 | use Kaliop\eZMigrationBundle\API\Value\MigrationDefinition; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $this->dbHandler = $this->container->get('ezpublish.connection'); |
| 37 | 37 | |
| 38 | 38 | $this->activeBundles = array(); |
| 39 | - foreach($this->container->get('kernel')->getBundles() as $bundle) |
|
| 39 | + foreach ($this->container->get('kernel')->getBundles() as $bundle) |
|
| 40 | 40 | { |
| 41 | 41 | $this->activeBundles[$bundle->getName()] = $bundle->getPath(); |
| 42 | 42 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // we need to decide of a random time to stamp existing migrations. We use 'now - 1 minute'... |
| 59 | 59 | $executionDate = time() - 60; |
| 60 | - foreach($toMigrate as $legacyMigration) { |
|
| 60 | + foreach ($toMigrate as $legacyMigration) { |
|
| 61 | 61 | $name = $legacyMigration['version']; |
| 62 | 62 | |
| 63 | 63 | $path = $this->getLegacyMigrationDefinition($legacyMigration['version'], $legacyMigration['bundle']); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | /** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */ |
| 106 | 106 | $sm = $this->dbHandler->getConnection()->getSchemaManager(); |
| 107 | - foreach($sm->listTables() as $table) { |
|
| 107 | + foreach ($sm->listTables() as $table) { |
|
| 108 | 108 | if ($table->getName() == $tableName) { |
| 109 | 109 | return true; |
| 110 | 110 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | return false; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - foreach($versionDefinitions as $key => $versionDefinition) { |
|
| 154 | + foreach ($versionDefinitions as $key => $versionDefinition) { |
|
| 155 | 155 | if (!in_array(pathinfo($versionDefinition, PATHINFO_EXTENSION), array('php', 'yml', 'sql'))) { |
| 156 | 156 | unset($versionDefinitions[$key]); |
| 157 | 157 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * @param MigrationStep[] $steps |
| 34 | 34 | * @param string $parsingError |
| 35 | 35 | */ |
| 36 | - function __construct($name, $path, $rawDefinition, $status = 0, array $steps=array(), $parsingError = null) |
|
| 36 | + function __construct($name, $path, $rawDefinition, $status = 0, array $steps = array(), $parsingError = null) |
|
| 37 | 37 | { |
| 38 | 38 | $this->name = $name; |
| 39 | 39 | $this->path = $path; |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $configuration = new Configuration(); |
| 23 | 23 | $config = $this->processConfiguration($configuration, $configs); |
| 24 | 24 | |
| 25 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 25 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 26 | 26 | $loader->load('services.yml'); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $migrationsService = $this->getMigrationService(); |
| 43 | 43 | |
| 44 | - $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')) ; |
|
| 44 | + $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')); |
|
| 45 | 45 | $migrations = $migrationsService->getMigrations(); |
| 46 | 46 | |
| 47 | 47 | if (!count($migrationDefinitions) && !count($migrations)) { |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // create a unique ist of all migrations (coming from db) and definitions (coming from disk) |
| 53 | 53 | $index = array(); |
| 54 | - foreach($migrationDefinitions as $migrationDefinition) { |
|
| 54 | + foreach ($migrationDefinitions as $migrationDefinition) { |
|
| 55 | 55 | $index[$migrationDefinition->name] = array('definition' => $migrationDefinition); |
| 56 | 56 | } |
| 57 | - foreach($migrations as $migration) { |
|
| 57 | + foreach ($migrations as $migration) { |
|
| 58 | 58 | if (isset($index[$migration->name])) { |
| 59 | 59 | $index[$migration->name]['migration'] = $migration; |
| 60 | 60 | } else { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $index[$migration->name]['definition'] = reset($migrationDefinitionCollection); |
| 70 | 70 | } |
| 71 | - } catch(\Exception $e) { |
|
| 71 | + } catch (\Exception $e) { |
|
| 72 | 72 | /// @todo one day we should be able to limit the kind of exceptions we have to catch here... |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $data = array(); |
| 82 | 82 | $i = 1; |
| 83 | - foreach($index as $name => $value) { |
|
| 83 | + foreach ($index as $name => $value) { |
|
| 84 | 84 | if (!isset($value['migration'])) { |
| 85 | 85 | $migrationDefinition = $migrationsService->parseMigrationDefinition($value['definition']); |
| 86 | 86 | $notes = ''; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if (empty($paths)) { |
| 58 | 58 | $paths = array(); |
| 59 | 59 | /** @var $bundle \Symfony\Component\HttpKernel\Bundle\BundleInterface */ |
| 60 | - foreach($this->kernel->getBundles() as $bundle) |
|
| 60 | + foreach ($this->kernel->getBundles() as $bundle) |
|
| 61 | 61 | { |
| 62 | 62 | $path = $bundle->getPath() . "/" . $this->versionDirectory; |
| 63 | 63 | if (is_dir($path)) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $definitions = array(); |
| 70 | - foreach($paths as $path) { |
|
| 70 | + foreach ($paths as $path) { |
|
| 71 | 71 | if (is_file($path)) { |
| 72 | 72 | $definitions[basename($path)] = $returnFilename ? $path : new MigrationDefinition( |
| 73 | 73 | basename($path), |
@@ -85,8 +85,7 @@ |
||
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | throw new \Exception("Path '$path' is neither a file nor directory"); |
| 91 | 90 | } |
| 92 | 91 | } |
@@ -32,8 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $fieldService = $this->fieldTypeMap[$fieldTypeIdentifier]; |
| 34 | 34 | return $fieldService->createValue($fieldValueArray, $context); |
| 35 | - } |
|
| 36 | - else |
|
| 35 | + } else |
|
| 37 | 36 | { |
| 38 | 37 | throw new \InvalidArgumentException("Field of type '$fieldTypeIdentifier' can not be handled as it does not have a complex field class defined"); |
| 39 | 38 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param string $fieldTypeIdentifier |
| 22 | 22 | * @param string $contentTypeIdentifier |
| 23 | 23 | */ |
| 24 | - public function addComplexField(ComplexFieldInterface $complexField, $fieldTypeIdentifier, $contentTypeIdentifier=null) |
|
| 24 | + public function addComplexField(ComplexFieldInterface $complexField, $fieldTypeIdentifier, $contentTypeIdentifier = null) |
|
| 25 | 25 | { |
| 26 | 26 | if ($contentTypeIdentifier == null) { |
| 27 | 27 | $contentTypeIdentifier = '*'; |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | if (isset($this->fieldTypeMap[$contentTypeIdentifier][$fieldTypeIdentifier]) || isset($this->fieldTypeMap['*'][$fieldTypeIdentifier])) |
| 53 | 53 | { |
| 54 | 54 | $fieldService = isset($this->fieldTypeMap[$contentTypeIdentifier][$fieldTypeIdentifier]) ? |
| 55 | - $this->fieldTypeMap[$contentTypeIdentifier][$fieldTypeIdentifier] : |
|
| 56 | - $this->fieldTypeMap['*'][$fieldTypeIdentifier]; |
|
| 55 | + $this->fieldTypeMap[$contentTypeIdentifier][$fieldTypeIdentifier] : $this->fieldTypeMap['*'][$fieldTypeIdentifier]; |
|
| 57 | 56 | return $fieldService->createValue($fieldValue, $context); |
| 58 | 57 | } |
| 59 | 58 | else |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | public function getReferenceValue($stringIdentifier) |
| 35 | 35 | { |
| 36 | 36 | $ref = $this->getReferenceIdentifierByPrefix($stringIdentifier); |
| 37 | - switch($ref['prefix']) { |
|
| 37 | + switch ($ref['prefix']) { |
|
| 38 | 38 | case 'content_remote_id:': |
| 39 | 39 | return $this->repository->getContentService()->loadContentByRemoteId($ref['identifier'])->id; |
| 40 | 40 | //case 'content_id::': |