@@ -43,8 +43,8 @@ |
||
| 43 | 43 | ) { |
| 44 | 44 | $queryBuilder = $this->createQueryBuilder() |
| 45 | 45 | ->delete($this->getTableName()) |
| 46 | - ->where(SchemaConfigurator::UUID_COLUMN . ' = ?') |
|
| 47 | - ->andWhere(SchemaConfigurator::OFFER_ID_COLUMN . ' = ?') |
|
| 46 | + ->where(SchemaConfigurator::UUID_COLUMN.' = ?') |
|
| 47 | + ->andWhere(SchemaConfigurator::OFFER_ID_COLUMN.' = ?') |
|
| 48 | 48 | ->setParameters([$uuid->toNative(), $offerUuid->toNative()]); |
| 49 | 49 | |
| 50 | 50 | $queryBuilder->execute(); |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * @param UUID $uuid |
| 130 | - * @return \CultuurNet\UDB3\ReadModel\JsonDocument[]|\Generator |
|
| 130 | + * @return \Generator |
|
| 131 | 131 | */ |
| 132 | 132 | private function getRelatedOffers(UUID $uuid) |
| 133 | 133 | { |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use Broadway\EventHandling\EventListenerInterface; |
| 8 | 8 | use CultuurNet\UDB3\Event\ReadModel\DocumentGoneException; |
| 9 | 9 | use CultuurNet\UDB3\Event\ReadModel\DocumentRepositoryInterface; |
| 10 | -use CultuurNet\UDB3\EventHandling\DelegateEventHandlingToSpecificMethodTrait; |
|
| 11 | 10 | use CultuurNet\UDB3\Label\Events\MadeInvisible; |
| 12 | 11 | use CultuurNet\UDB3\Label\Events\MadeVisible; |
| 13 | 12 | use CultuurNet\UDB3\Label\LabelDomainMessageEnricher; |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | foreach ($offers as $offer) { |
| 99 | 99 | $offerLd = $offer->getBody(); |
| 100 | 100 | |
| 101 | - $addToArray = isset($offerLd->{$addTo}) ? (array) $offerLd->{$addTo} : []; |
|
| 101 | + $addToArray = isset($offerLd->{$addTo}) ? (array)$offerLd->{$addTo} : []; |
|
| 102 | 102 | |
| 103 | 103 | $addToArray[] = $labelName; |
| 104 | 104 | $offerLd->{$addTo} = array_unique($addToArray); |
| 105 | 105 | |
| 106 | 106 | if (isset($offerLd->{$removeFrom})) { |
| 107 | - $offerLd->{$removeFrom} = array_diff((array) $offerLd->{$removeFrom}, [$labelName]); |
|
| 107 | + $offerLd->{$removeFrom} = array_diff((array)$offerLd->{$removeFrom}, [$labelName]); |
|
| 108 | 108 | |
| 109 | 109 | if (count($offerLd->{$removeFrom}) === 0) { |
| 110 | 110 | unset($offerLd->{$removeFrom}); |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | $this->offerRepository->save($offer->withBody($offerLd)); |
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | - $this->logger->alert('Could not apply visibility for label: ' . |
|
| 118 | - $uuid . ' because label name not found in meta data!'); |
|
| 117 | + $this->logger->alert('Could not apply visibility for label: '. |
|
| 118 | + $uuid.' because label name not found in meta data!'); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | foreach ($offerRelations as $offerRelation) { |
| 131 | 131 | try { |
| 132 | - $offer = $this->offerRepository->get((string) $offerRelation->getOfferId()); |
|
| 132 | + $offer = $this->offerRepository->get((string)$offerRelation->getOfferId()); |
|
| 133 | 133 | |
| 134 | 134 | if ($offer) { |
| 135 | 135 | yield $offer; |
| 136 | 136 | } |
| 137 | 137 | } catch (DocumentGoneException $exception) { |
| 138 | 138 | $this->logger->alert( |
| 139 | - 'Can not update visibility of label: "'. $offerRelation->getUuid() . '"' |
|
| 140 | - . ' for the offer with id: "' . $offerRelation->getOfferId() . '"' |
|
| 139 | + 'Can not update visibility of label: "'.$offerRelation->getUuid().'"' |
|
| 140 | + . ' for the offer with id: "'.$offerRelation->getOfferId().'"' |
|
| 141 | 141 | . ' because the document could not be retrieved.' |
| 142 | 142 | ); |
| 143 | 143 | } |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $schema = $schemaManager->createSchema(); |
| 44 | 44 | |
| 45 | - if (!$schema->hasTable((string) $this->userRoleTableName)) { |
|
| 46 | - $userRoleTable = $schema->createTable((string) $this->userRoleTableName); |
|
| 45 | + if (!$schema->hasTable((string)$this->userRoleTableName)) { |
|
| 46 | + $userRoleTable = $schema->createTable((string)$this->userRoleTableName); |
|
| 47 | 47 | |
| 48 | 48 | $userRoleTable->addColumn(self::USER_ID_COLUMN, Type::GUID) |
| 49 | 49 | ->setLength(36) |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | $schemaManager->createTable($userRoleTable); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (!$schema->hasTable((string) $this->rolePermissionTableName)) { |
|
| 63 | - $rolePermissionTable = $schema->createTable((string) $this->rolePermissionTableName); |
|
| 62 | + if (!$schema->hasTable((string)$this->rolePermissionTableName)) { |
|
| 63 | + $rolePermissionTable = $schema->createTable((string)$this->rolePermissionTableName); |
|
| 64 | 64 | |
| 65 | 65 | $rolePermissionTable->addColumn(self::ROLE_ID_COLUMN, Type::GUID) |
| 66 | 66 | ->setLength(36) |
@@ -47,19 +47,19 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $userRoleQuery = $this->connection->createQueryBuilder() |
| 49 | 49 | ->select(SchemaConfigurator::ROLE_ID_COLUMN) |
| 50 | - ->from((string) $this->userRoleTableName) |
|
| 51 | - ->where(SchemaConfigurator::USER_ID_COLUMN . ' = :userId'); |
|
| 50 | + ->from((string)$this->userRoleTableName) |
|
| 51 | + ->where(SchemaConfigurator::USER_ID_COLUMN.' = :userId'); |
|
| 52 | 52 | |
| 53 | 53 | $userPermissionQuery = $this->connection->createQueryBuilder() |
| 54 | - ->select('DISTINCT ' . SchemaConfigurator::PERMISSION_COLUMN) |
|
| 54 | + ->select('DISTINCT '.SchemaConfigurator::PERMISSION_COLUMN) |
|
| 55 | 55 | ->from($this->rolePermissionTableName, 'rp') |
| 56 | 56 | ->leftJoin( |
| 57 | 57 | 'rp', |
| 58 | 58 | sprintf('(%s)', $userRoleQuery->getSQL()), |
| 59 | 59 | 'up', |
| 60 | - 'rp.' . SchemaConfigurator::ROLE_ID_COLUMN .' = up.' . SchemaConfigurator::ROLE_ID_COLUMN |
|
| 60 | + 'rp.'.SchemaConfigurator::ROLE_ID_COLUMN.' = up.'.SchemaConfigurator::ROLE_ID_COLUMN |
|
| 61 | 61 | ) |
| 62 | - ->setParameter('userId', (string) $userId); |
|
| 62 | + ->setParameter('userId', (string)$userId); |
|
| 63 | 63 | |
| 64 | 64 | $results = $userPermissionQuery->execute()->fetchAll(\PDO::FETCH_COLUMN); |
| 65 | 65 | |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | $this->connection->insert( |
| 77 | 77 | $this->rolePermissionTableName, |
| 78 | 78 | array( |
| 79 | - SchemaConfigurator::ROLE_ID_COLUMN => (string) $roleId, |
|
| 80 | - SchemaConfigurator::PERMISSION_COLUMN => (string) $permission |
|
| 79 | + SchemaConfigurator::ROLE_ID_COLUMN => (string)$roleId, |
|
| 80 | + SchemaConfigurator::PERMISSION_COLUMN => (string)$permission |
|
| 81 | 81 | ) |
| 82 | 82 | ); |
| 83 | 83 | } |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | $this->connection->delete( |
| 91 | 91 | $this->rolePermissionTableName, |
| 92 | 92 | array( |
| 93 | - SchemaConfigurator::ROLE_ID_COLUMN => (string) $roleId, |
|
| 94 | - SchemaConfigurator::PERMISSION_COLUMN => (string) $permission |
|
| 93 | + SchemaConfigurator::ROLE_ID_COLUMN => (string)$roleId, |
|
| 94 | + SchemaConfigurator::PERMISSION_COLUMN => (string)$permission |
|
| 95 | 95 | ) |
| 96 | 96 | ); |
| 97 | 97 | } |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | $this->connection->insert( |
| 105 | 105 | $this->userRoleTableName, |
| 106 | 106 | array( |
| 107 | - SchemaConfigurator::ROLE_ID_COLUMN => (string) $roleId, |
|
| 108 | - SchemaConfigurator::USER_ID_COLUMN => (string) $userId |
|
| 107 | + SchemaConfigurator::ROLE_ID_COLUMN => (string)$roleId, |
|
| 108 | + SchemaConfigurator::USER_ID_COLUMN => (string)$userId |
|
| 109 | 109 | ) |
| 110 | 110 | ); |
| 111 | 111 | } |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | $this->connection->delete( |
| 119 | 119 | $this->userRoleTableName, |
| 120 | 120 | array( |
| 121 | - SchemaConfigurator::USER_ID_COLUMN => (string) $userId, |
|
| 122 | - SchemaConfigurator::ROLE_ID_COLUMN => (string) $roleId |
|
| 121 | + SchemaConfigurator::USER_ID_COLUMN => (string)$userId, |
|
| 122 | + SchemaConfigurator::ROLE_ID_COLUMN => (string)$roleId |
|
| 123 | 123 | ) |
| 124 | 124 | ); |
| 125 | 125 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $schema = $schemaManager->createSchema(); |
| 32 | 32 | |
| 33 | - if (!$schema->hasTable((string) $this->labelRolesTableName)) { |
|
| 33 | + if (!$schema->hasTable((string)$this->labelRolesTableName)) { |
|
| 34 | 34 | $labelRolesTable = $schema->createTable( |
| 35 | 35 | $this->labelRolesTableName->toNative() |
| 36 | 36 | ); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function getByUuid(UUID $uuid) |
| 55 | 55 | { |
| 56 | 56 | $aliases = $this->getAliases(); |
| 57 | - $whereId = SchemaConfigurator::UUID_COLUMN . ' = ?'; |
|
| 57 | + $whereId = SchemaConfigurator::UUID_COLUMN.' = ?'; |
|
| 58 | 58 | |
| 59 | 59 | $queryBuilder = $this->createQueryBuilder()->select($aliases) |
| 60 | 60 | ->from($this->getTableName()->toNative()) |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function getByName(StringLiteral $name) |
| 72 | 72 | { |
| 73 | 73 | $aliases = $this->getAliases(); |
| 74 | - $whereName = SchemaConfigurator::NAME_COLUMN . ' = ?'; |
|
| 74 | + $whereName = SchemaConfigurator::NAME_COLUMN.' = ?'; |
|
| 75 | 75 | |
| 76 | 76 | $queryBuilder = $this->createQueryBuilder()->select($aliases) |
| 77 | 77 | ->from($this->getTableName()->toNative()) |
@@ -173,15 +173,15 @@ discard block |
||
| 173 | 173 | private function createUserLabelsSubQuery(Query $query) |
| 174 | 174 | { |
| 175 | 175 | return $this->createQueryBuilder() |
| 176 | - ->select('DISTINCT ' . LabelRolesSchemaConfigurator::LABEL_ID_COLUMN) |
|
| 176 | + ->select('DISTINCT '.LabelRolesSchemaConfigurator::LABEL_ID_COLUMN) |
|
| 177 | 177 | ->from($this->userRolesTableName->toNative(), 'ur') |
| 178 | 178 | ->innerJoin( |
| 179 | 179 | 'ur', |
| 180 | 180 | $this->labelRolesTableName->toNative(), |
| 181 | 181 | 'lr', |
| 182 | - 'ur.' . PermissionsSchemaConfigurator::ROLE_ID_COLUMN . ' = lr.' . LabelRolesSchemaConfigurator::ROLE_ID_COLUMN |
|
| 182 | + 'ur.'.PermissionsSchemaConfigurator::ROLE_ID_COLUMN.' = lr.'.LabelRolesSchemaConfigurator::ROLE_ID_COLUMN |
|
| 183 | 183 | ) |
| 184 | - ->where('ur.' . PermissionsSchemaConfigurator::USER_ID_COLUMN . '= :' . PermissionsSchemaConfigurator::USER_ID_COLUMN); |
|
| 184 | + ->where('ur.'.PermissionsSchemaConfigurator::USER_ID_COLUMN.'= :'.PermissionsSchemaConfigurator::USER_ID_COLUMN); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | { |
| 208 | 208 | return $queryBuilder->expr()->like( |
| 209 | 209 | SchemaConfigurator::NAME_COLUMN, |
| 210 | - ':' . SchemaConfigurator::NAME_COLUMN |
|
| 210 | + ':'.SchemaConfigurator::NAME_COLUMN |
|
| 211 | 211 | ); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | private function createLikeParameter(Query $query) |
| 219 | 219 | { |
| 220 | - return '%' . $query->getValue()->toNative() . '%'; |
|
| 220 | + return '%'.$query->getValue()->toNative().'%'; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $this->saveNewDocument( |
| 23 | 23 | $roleCreated->getUuid()->toNative(), |
| 24 | - function (\stdClass $json) use ($roleCreated) { |
|
| 24 | + function(\stdClass $json) use ($roleCreated) { |
|
| 25 | 25 | $json->uuid = $roleCreated->getUuid()->toNative(); |
| 26 | 26 | $json->name = $roleCreated->getName()->toNative(); |
| 27 | 27 | $json->permissions = []; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $json->permissions = array_values( |
| 139 | 139 | array_filter( |
| 140 | 140 | $json->permissions, |
| 141 | - function ($item) use ($permissionName) { |
|
| 141 | + function($item) use ($permissionName) { |
|
| 142 | 142 | return $item !== $permissionName; |
| 143 | 143 | } |
| 144 | 144 | ) |
@@ -63,34 +63,34 @@ |
||
| 63 | 63 | $userRolesSubQuery = $this->connection->createQueryBuilder() |
| 64 | 64 | ->select(PermissionsSchemaConfigurator::ROLE_ID_COLUMN) |
| 65 | 65 | ->from($this->userRolesTableName->toNative()) |
| 66 | - ->where(PermissionsSchemaConfigurator::USER_ID_COLUMN . ' = :userId'); |
|
| 66 | + ->where(PermissionsSchemaConfigurator::USER_ID_COLUMN.' = :userId'); |
|
| 67 | 67 | |
| 68 | 68 | $queryBuilder = $this->connection->createQueryBuilder(); |
| 69 | 69 | $userConstraintsQuery = $queryBuilder |
| 70 | - ->select('rs.' . SearchSchemaConfigurator::CONSTRAINT_COLUMN) |
|
| 70 | + ->select('rs.'.SearchSchemaConfigurator::CONSTRAINT_COLUMN) |
|
| 71 | 71 | ->from($this->rolesSearchTableName, 'rs') |
| 72 | 72 | ->innerJoin( |
| 73 | 73 | 'rs', |
| 74 | 74 | sprintf('(%s)', $userRolesSubQuery->getSQL()), |
| 75 | 75 | 'ur', |
| 76 | - 'rs.' . SearchSchemaConfigurator::UUID_COLUMN . ' = ur.' . PermissionsSchemaConfigurator::ROLE_ID_COLUMN |
|
| 76 | + 'rs.'.SearchSchemaConfigurator::UUID_COLUMN.' = ur.'.PermissionsSchemaConfigurator::ROLE_ID_COLUMN |
|
| 77 | 77 | ) |
| 78 | 78 | ->innerJoin( |
| 79 | 79 | 'rs', |
| 80 | 80 | $this->rolePermissionsTableName->toNative(), |
| 81 | 81 | 'rp', |
| 82 | - 'rs.' . SearchSchemaConfigurator::UUID_COLUMN . ' = rp.' . PermissionsSchemaConfigurator::ROLE_ID_COLUMN |
|
| 82 | + 'rs.'.SearchSchemaConfigurator::UUID_COLUMN.' = rp.'.PermissionsSchemaConfigurator::ROLE_ID_COLUMN |
|
| 83 | 83 | ) |
| 84 | - ->where(PermissionsSchemaConfigurator::PERMISSION_COLUMN . ' = :permission') |
|
| 84 | + ->where(PermissionsSchemaConfigurator::PERMISSION_COLUMN.' = :permission') |
|
| 85 | 85 | ->andWhere($queryBuilder->expr()->isNotNull( |
| 86 | - 'rs.' . SearchSchemaConfigurator::CONSTRAINT_COLUMN |
|
| 86 | + 'rs.'.SearchSchemaConfigurator::CONSTRAINT_COLUMN |
|
| 87 | 87 | )) |
| 88 | 88 | ->setParameter('userId', $userId->toNative()) |
| 89 | 89 | ->setParameter('permission', $permission->toNative()); |
| 90 | 90 | |
| 91 | 91 | $results = $userConstraintsQuery->execute()->fetchAll(\PDO::FETCH_COLUMN); |
| 92 | 92 | |
| 93 | - return array_map(function ($constraint) { |
|
| 93 | + return array_map(function($constraint) { |
|
| 94 | 94 | return new StringLiteral($constraint); |
| 95 | 95 | }, $results); |
| 96 | 96 | } |