@@ -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::': |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | 17 | $quotedPrefixes = []; |
| 18 | - foreach($this->referencePrefixes as $prefix) { |
|
| 18 | + foreach ($this->referencePrefixes as $prefix) { |
|
| 19 | 19 | $quotedPrefixes[] = preg_quote($prefix, '/'); |
| 20 | 20 | } |
| 21 | 21 | $this->prefixMatchRegexp = '/^(' . implode('|', $quotedPrefixes) . ')/'; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected function getReferenceIdentifierByPrefix($stringIdentifier) |
| 57 | 57 | { |
| 58 | - foreach($this->referencePrefixes as $prefix) { |
|
| 58 | + foreach ($this->referencePrefixes as $prefix) { |
|
| 59 | 59 | $regexp = '/^' . preg_quote($prefix, '/') . '/'; |
| 60 | 60 | if (preg_match($regexp, $stringIdentifier)) { |
| 61 | 61 | return array('prefix' => $prefix, 'identifier' => preg_replace($regexp, '', $stringIdentifier)); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $t->addColumn('execution_error', 'string', array('length' => 4000, 'notnull' => false)); |
| 283 | 283 | $t->setPrimaryKey(array('migration')); |
| 284 | 284 | |
| 285 | - foreach($schema->toSql($dbPlatform) as $sql) { |
|
| 285 | + foreach ($schema->toSql($dbPlatform) as $sql) { |
|
| 286 | 286 | $this->dbHandler->exec($sql); |
| 287 | 287 | } |
| 288 | 288 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | { |
| 298 | 298 | /** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */ |
| 299 | 299 | $sm = $this->dbHandler->getConnection()->getSchemaManager(); |
| 300 | - foreach($sm->listTables() as $table) { |
|
| 300 | + foreach ($sm->listTables() as $table) { |
|
| 301 | 301 | if ($table->getName() == $tableName) { |
| 302 | 302 | return true; |
| 303 | 303 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | break; |
| 58 | 58 | case 'SiteAccess': |
| 59 | - foreach($values as $value) { |
|
| 59 | + foreach ($values as $value) { |
|
| 60 | 60 | $name = "No Site Access Found"; |
| 61 | 61 | if (array_key_exists($value, $this->siteAccessList)) { |
| 62 | 62 | $name = $this->siteAccessList[$value]; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $availableLanguages = $this->translationHelper->getAvailableLanguages(); |
| 72 | 72 | $primaryLanguage = $availableLanguages[0]; |
| 73 | 73 | |
| 74 | - foreach($values as $value) { |
|
| 74 | + foreach ($values as $value) { |
|
| 75 | 75 | $contentType = $contentTypeService->loadContentType($value); |
| 76 | 76 | $retValues[] = $contentType->identifier; |
| 77 | 77 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | break; |
| 125 | 125 | case 'SiteAccess': |
| 126 | - foreach($values as $value) { |
|
| 126 | + foreach ($values as $value) { |
|
| 127 | 127 | foreach ($this->siteAccessList as $key => $siteAccess) { |
| 128 | 128 | if ($value == $siteAccess) { |
| 129 | 129 | $retValues[] = (string)$key; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | /** @var \eZ\Publish\API\Repository\ContentTypeService $contentTypeService */ |
| 137 | 137 | $contentTypeService = $this->repository->getContentTypeService(); |
| 138 | 138 | |
| 139 | - foreach($values as $value) { |
|
| 139 | + foreach ($values as $value) { |
|
| 140 | 140 | $contentTypeId = $value; |
| 141 | 141 | if (!is_int($value)) { |
| 142 | 142 | $contentType = $contentTypeService->loadContentTypeByIdentifier($value); |
@@ -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::': |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | if (array_key_exists('policies', $this->dsl)) { |
| 44 | 44 | $ymlPolicies = $this->dsl['policies']; |
| 45 | - foreach($ymlPolicies as $key => $ymlPolicy) { |
|
| 45 | + foreach ($ymlPolicies as $key => $ymlPolicy) { |
|
| 46 | 46 | $this->addPolicy($role, $roleService, $ymlPolicy); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | // Removing all policies so we can add them back. |
| 83 | 83 | // TODO: Check and update policies instead of remove and add. |
| 84 | 84 | $policies = $role->getPolicies(); |
| 85 | - foreach($policies as $policy) { |
|
| 85 | + foreach ($policies as $policy) { |
|
| 86 | 86 | $roleService->deletePolicy($policy); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - foreach($ymlPolicies as $key => $ymlPolicy) { |
|
| 89 | + foreach ($ymlPolicies as $key => $ymlPolicy) { |
|
| 90 | 90 | $this->addPolicy($role, $roleService, $ymlPolicy); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']); |
| 177 | 177 | |
| 178 | - foreach($limitationValue as $id => $value) { |
|
| 178 | + foreach ($limitationValue as $id => $value) { |
|
| 179 | 179 | if ($this->referenceResolver->isReference($value)) { |
| 180 | 180 | $value = $this->referenceResolver->getReferenceValue($value); |
| 181 | 181 | $limitationValue[$id] = $value; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $activeBundles = array(); |
| 83 | - foreach($this->getApplication()->getKernel()->getBundles() as $bundle) |
|
| 83 | + foreach ($this->getApplication()->getKernel()->getBundles() as $bundle) |
|
| 84 | 84 | { |
| 85 | 85 | $activeBundles[] = $bundle->getName(); |
| 86 | 86 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $className = 'Migration'; |
| 156 | 156 | } |
| 157 | 157 | // Make sure that php class names are unique, not only migration definition file names |
| 158 | - $existingMigrations = count(glob($migrationDirectory.'/*_' . $className .'*.php')); |
|
| 158 | + $existingMigrations = count(glob($migrationDirectory . '/*_' . $className . '*.php')); |
|
| 159 | 159 | if ($existingMigrations) { |
| 160 | 160 | $className = $className . sprintf('%03d', $existingMigrations + 1); |
| 161 | 161 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if ($migrationType == 'role') { |
| 202 | 202 | $code = $this->generateRoleTemplate($parameters['role']); |
| 203 | 203 | } else { |
| 204 | - $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:'.$template, $parameters); |
|
| 204 | + $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:' . $template, $parameters); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | file_put_contents($path, $code); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $draft = $contentService->createContentDraft($contentInfo); |
| 180 | - $contentService->updateContent($draft->versionInfo,$contentUpdateStruct); |
|
| 180 | + $contentService->updateContent($draft->versionInfo, $contentUpdateStruct); |
|
| 181 | 181 | $content = $contentService->publishVersion($draft->versionInfo); |
| 182 | 182 | |
| 183 | 183 | if (array_key_exists('new_remote_id', $this->dsl)) { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @param ContentCreateStruct $createStruct |
| 222 | 222 | * @param array $fields |
| 223 | 223 | */ |
| 224 | - protected function setFields(ContentCreateStruct &$createStruct, array $fields) |
|
| 224 | + protected function setFields(ContentCreateStruct & $createStruct, array $fields) |
|
| 225 | 225 | { |
| 226 | 226 | foreach ($fields as $field) { |
| 227 | 227 | // each $field is one key value pair |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @param ContentUpdateStruct $updateStruct |
| 249 | 249 | * @param array $fields |
| 250 | 250 | */ |
| 251 | - protected function setFieldsToUpdate(ContentUpdateStruct &$updateStruct, array $fields, ContentType $contentType) |
|
| 251 | + protected function setFieldsToUpdate(ContentUpdateStruct & $updateStruct, array $fields, ContentType $contentType) |
|
| 252 | 252 | { |
| 253 | 253 | foreach ($fields as $field) { |
| 254 | 254 | // each $field is one key value pair |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $migrationsService = $this->getMigrationService(); |
| 64 | 64 | |
| 65 | - $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')) ; |
|
| 65 | + $migrationDefinitions = $migrationsService->getMigrationsDefinitions($input->getOption('path')); |
|
| 66 | 66 | $migrations = $migrationsService->getMigrations(); |
| 67 | 67 | |
| 68 | 68 | if (!count($migrationDefinitions)) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // filter away all migrations except 'to do' ones |
| 74 | 74 | $toExecute = array(); |
| 75 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
| 75 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
| 76 | 76 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) { |
| 77 | 77 | $toExecute[$name] = $migrationsService->parseMigrationDefinition($migrationDefinition); |
| 78 | 78 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $data = array(); |
| 91 | 91 | $i = 1; |
| 92 | - foreach($toExecute as $name => $migrationDefinition) { |
|
| 92 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
| 93 | 93 | $notes = ''; |
| 94 | 94 | if ($migrationDefinition->status != MigrationDefinition::STATUS_PARSED) { |
| 95 | 95 | $notes = '<error>' . $migrationDefinition->parsingError . '</error>'; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $output->writeln("=============================================\n"); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - foreach($toExecute as $name => $migrationDefinition) { |
|
| 127 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
| 128 | 128 | |
| 129 | 129 | // let's skip migrations that we know are invalid - user was warned and he decide to proceed anyway |
| 130 | 130 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | try { |
| 138 | 138 | $migrationsService->executeMigration($migrationDefinition); |
| 139 | - } catch(\Exception $e) { |
|
| 139 | + } catch (\Exception $e) { |
|
| 140 | 140 | if ($input->getOption('ignore-failures')) { |
| 141 | - $output->writeln("\n<error>Migration failed! Reason: ".$this->getFullExceptionMessage($e)."</error>\n"); |
|
| 141 | + $output->writeln("\n<error>Migration failed! Reason: " . $this->getFullExceptionMessage($e) . "</error>\n"); |
|
| 142 | 142 | continue; |
| 143 | 143 | } |
| 144 | - $output->writeln("\n<error>Migration aborted! Reason: ".$this->getFullExceptionMessage($e)."</error>"); |
|
| 144 | + $output->writeln("\n<error>Migration aborted! Reason: " . $this->getFullExceptionMessage($e) . "</error>"); |
|
| 145 | 145 | return 1; |
| 146 | 146 | } |
| 147 | 147 | |