| Conditions | 7 | 
| Paths | 25 | 
| Total Lines | 251 | 
| Code Lines | 177 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 25 | public function up(Schema $schema)  | 
            ||
| 26 |     { | 
            ||
| 27 | $platform = $this->connection->getDatabasePlatform()->getName();  | 
            ||
| 28 |         $cipherService = $this->container->get('ds_encryption.service.cipher'); | 
            ||
| 29 | |||
| 30 |         switch ($platform) { | 
            ||
| 31 | case 'postgresql':  | 
            ||
| 32 | // Schema  | 
            ||
| 33 |                 $this->addSql('CREATE SEQUENCE ds_config_id_seq INCREMENT BY 1 MINVALUE 1 START 9'); | 
            ||
| 34 |                 $this->addSql('CREATE SEQUENCE ds_parameter_id_seq INCREMENT BY 1 MINVALUE 1 START 4'); | 
            ||
| 35 |                 $this->addSql('CREATE SEQUENCE ds_metadata_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 36 |                 $this->addSql('CREATE SEQUENCE ds_metadata_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 37 |                 $this->addSql('CREATE SEQUENCE ds_access_id_seq INCREMENT BY 1 MINVALUE 1 START 3'); | 
            ||
| 38 |                 $this->addSql('CREATE SEQUENCE ds_access_permission_id_seq INCREMENT BY 1 MINVALUE 1 START 7'); | 
            ||
| 39 |                 $this->addSql('CREATE SEQUENCE ds_tenant_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 40 |                 $this->addSql('CREATE SEQUENCE app_data_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 41 |                 $this->addSql('CREATE SEQUENCE app_data_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 42 |                 $this->addSql('CREATE SEQUENCE app_file_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 43 |                 $this->addSql('CREATE SEQUENCE app_file_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 44 |                 $this->addSql('CREATE SEQUENCE app_page_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 45 |                 $this->addSql('CREATE SEQUENCE app_page_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 46 |                 $this->addSql('CREATE SEQUENCE app_text_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 47 |                 $this->addSql('CREATE SEQUENCE app_text_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 48 |                 $this->addSql('CREATE TABLE ds_config (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, "key" VARCHAR(255) NOT NULL, value TEXT DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 49 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_758C45F4D17F50A6 ON ds_config (uuid)'); | 
            ||
| 50 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_758C45F48A90ABA94E59C462 ON ds_config (key, tenant)'); | 
            ||
| 51 |                 $this->addSql('CREATE TABLE ds_parameter (id INT NOT NULL, "key" VARCHAR(255) NOT NULL, value TEXT DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 52 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_B3C0FD91F48571EB ON ds_parameter ("key")'); | 
            ||
| 53 |                 $this->addSql('CREATE TABLE ds_metadata (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, slug VARCHAR(255) NOT NULL, type VARCHAR(255) DEFAULT NULL, data JSON NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 54 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_11290F17D17F50A6 ON ds_metadata (uuid)'); | 
            ||
| 55 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_11290F17989D9B624E59C462 ON ds_metadata (slug, tenant)'); | 
            ||
| 56 |                 $this->addSql('CREATE TABLE ds_metadata_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 57 |                 $this->addSql('CREATE INDEX IDX_A6447E202C2AC5D3 ON ds_metadata_trans (translatable_id)'); | 
            ||
| 58 |                 $this->addSql('CREATE UNIQUE INDEX ds_metadata_trans_unique_translation ON ds_metadata_trans (translatable_id, locale)'); | 
            ||
| 59 |                 $this->addSql('CREATE TABLE ds_access (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, assignee VARCHAR(255) DEFAULT NULL, assignee_uuid UUID DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 60 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_A76F41DCD17F50A6 ON ds_access (uuid)'); | 
            ||
| 61 |                 $this->addSql('CREATE TABLE ds_access_permission (id INT NOT NULL, access_id INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, entity VARCHAR(255) DEFAULT NULL, entity_uuid UUID DEFAULT NULL, "key" VARCHAR(255) NOT NULL, attributes JSON NOT NULL, tenant UUID NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 62 |                 $this->addSql('CREATE INDEX IDX_D46DD4D04FEA67CF ON ds_access_permission (access_id)'); | 
            ||
| 63 |                 $this->addSql('CREATE TABLE ds_tenant (id INT NOT NULL, uuid UUID NOT NULL, data JSON NOT NULL, version INT DEFAULT 1 NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 64 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_EF5FAEEAD17F50A6 ON ds_tenant (uuid)'); | 
            ||
| 65 |                 $this->addSql('CREATE TABLE app_data (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, slug VARCHAR(255) NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 66 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_A8DDD6C3D17F50A6 ON app_data (uuid)'); | 
            ||
| 67 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_A8DDD6C3989D9B624E59C462 ON app_data (slug, tenant)'); | 
            ||
| 68 |                 $this->addSql('CREATE TABLE app_data_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, data JSON NOT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 69 |                 $this->addSql('CREATE INDEX IDX_6885795E2C2AC5D3 ON app_data_trans (translatable_id)'); | 
            ||
| 70 |                 $this->addSql('CREATE UNIQUE INDEX app_data_trans_unique_translation ON app_data_trans (translatable_id, locale)'); | 
            ||
| 71 |                 $this->addSql('CREATE TABLE app_file (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, slug VARCHAR(255) NOT NULL, "type" VARCHAR(255) DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 72 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_89B113B0D17F50A6 ON app_file (uuid)'); | 
            ||
| 73 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_89B113B0989D9B624E59C462 ON app_file (slug, tenant)'); | 
            ||
| 74 |                 $this->addSql('CREATE TABLE app_file_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, presentation TEXT DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 75 |                 $this->addSql('CREATE INDEX IDX_8CB905F62C2AC5D3 ON app_file_trans (translatable_id)'); | 
            ||
| 76 |                 $this->addSql('CREATE UNIQUE INDEX app_file_trans_unique_translation ON app_file_trans (translatable_id, locale)'); | 
            ||
| 77 |                 $this->addSql('CREATE TABLE app_page (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, slug VARCHAR(255) NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 78 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_11249380D17F50A6 ON app_page (uuid)'); | 
            ||
| 79 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_11249380989D9B624E59C462 ON app_page (slug, tenant)'); | 
            ||
| 80 |                 $this->addSql('CREATE TABLE app_page_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 81 |                 $this->addSql('CREATE INDEX IDX_40BB4A172C2AC5D3 ON app_page_trans (translatable_id)'); | 
            ||
| 82 |                 $this->addSql('CREATE UNIQUE INDEX app_page_trans_unique_translation ON app_page_trans (translatable_id, locale)'); | 
            ||
| 83 |                 $this->addSql('CREATE TABLE app_text (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, slug VARCHAR(255) NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 84 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_3EA58267D17F50A6 ON app_text (uuid)'); | 
            ||
| 85 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_3EA58267989D9B624E59C462 ON app_text (slug, tenant)'); | 
            ||
| 86 |                 $this->addSql('CREATE TABLE app_text_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, value VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 87 |                 $this->addSql('CREATE INDEX IDX_708E0F9C2C2AC5D3 ON app_text_trans (translatable_id)'); | 
            ||
| 88 |                 $this->addSql('CREATE UNIQUE INDEX app_text_trans_unique_translation ON app_text_trans (translatable_id, locale)'); | 
            ||
| 89 |                 $this->addSql('ALTER TABLE ds_metadata_trans ADD CONSTRAINT FK_A6447E202C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES ds_metadata (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 90 |                 $this->addSql('ALTER TABLE ds_access_permission ADD CONSTRAINT FK_D46DD4D04FEA67CF FOREIGN KEY (access_id) REFERENCES ds_access (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 91 |                 $this->addSql('ALTER TABLE app_data_trans ADD CONSTRAINT FK_6885795E2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_data (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 92 |                 $this->addSql('ALTER TABLE app_file_trans ADD CONSTRAINT FK_8CB905F62C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_file (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 93 |                 $this->addSql('ALTER TABLE app_page_trans ADD CONSTRAINT FK_40BB4A172C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_page (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 94 |                 $this->addSql('ALTER TABLE app_text_trans ADD CONSTRAINT FK_708E0F9C2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_text (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 95 |                 $this->addSql('CREATE TABLE ds_session (id VARCHAR(128) NOT NULL PRIMARY KEY, data BYTEA NOT NULL, time INTEGER NOT NULL, lifetime INTEGER NOT NULL)'); | 
            ||
| 96 | |||
| 97 | // Data  | 
            ||
| 98 |                 $yml = file_get_contents('/srv/api-platform/src/AppBundle/Resources/migrations/1_0_0.yml'); | 
            ||
| 99 | $data = Yaml::parse($yml);  | 
            ||
| 100 | $i = 0;  | 
            ||
| 101 | $parameters = [  | 
            ||
| 102 | [  | 
            ||
| 103 | 'key' => 'ds_system.user.username',  | 
            ||
| 104 | 'value' => serialize($data['system']['username'])  | 
            ||
| 105 | ],  | 
            ||
| 106 | [  | 
            ||
| 107 | 'key' => 'ds_system.user.password',  | 
            ||
| 108 | 'value' => $cipherService->encrypt($data['system']['password'])  | 
            ||
| 109 | ],  | 
            ||
| 110 | [  | 
            ||
| 111 | 'key' => 'ds_tenant.tenant.default',  | 
            ||
| 112 | 'value' => serialize($data['tenant']['uuid'])  | 
            ||
| 113 | ]  | 
            ||
| 114 | ];  | 
            ||
| 115 | |||
| 116 |                 foreach ($parameters as $parameter) { | 
            ||
| 117 | $this->addSql(sprintf(  | 
            ||
| 118 | 'INSERT INTO ds_parameter (id, key, value) VALUES (%d, %s, %s);',  | 
            ||
| 119 | ++$i,  | 
            ||
| 120 | $this->connection->quote($parameter['key']),  | 
            ||
| 121 | $this->connection->quote($parameter['value'])  | 
            ||
| 122 | ));  | 
            ||
| 123 | }  | 
            ||
| 124 | |||
| 125 | $i = 0;  | 
            ||
| 126 | $tenants = [  | 
            ||
| 127 | [  | 
            ||
| 128 | 'uuid' => $data['tenant']['uuid'],  | 
            ||
| 129 | 'data' => '"'.$cipherService->encrypt(new stdClass).'"'  | 
            ||
| 130 | ]  | 
            ||
| 131 | ];  | 
            ||
| 132 | |||
| 133 |                 foreach ($tenants as $tenant) { | 
            ||
| 134 | $this->addSql(sprintf(  | 
            ||
| 135 | 'INSERT INTO ds_tenant (id, uuid, data, created_at, updated_at) VALUES (%d, %s, %s, %s, %s);',  | 
            ||
| 136 | ++$i,  | 
            ||
| 137 | $this->connection->quote($tenant['uuid']),  | 
            ||
| 138 | $this->connection->quote($tenant['data']),  | 
            ||
| 139 | 'now()',  | 
            ||
| 140 | 'now()'  | 
            ||
| 141 | ));  | 
            ||
| 142 | }  | 
            ||
| 143 | |||
| 144 | $i = 0;  | 
            ||
| 145 | $configs = [  | 
            ||
| 146 | [  | 
            ||
| 147 | 'key' => 'ds_api.user.username',  | 
            ||
| 148 | 'value' => serialize($data['user']['system']['username'])  | 
            ||
| 149 | ],  | 
            ||
| 150 | [  | 
            ||
| 151 | 'key' => 'ds_api.user.password',  | 
            ||
| 152 | 'value' => $cipherService->encrypt($data['user']['system']['password'])  | 
            ||
| 153 | ],  | 
            ||
| 154 | [  | 
            ||
| 155 | 'key' => 'ds_api.user.uuid',  | 
            ||
| 156 | 'value' => serialize($data['user']['system']['uuid'])  | 
            ||
| 157 | ],  | 
            ||
| 158 | [  | 
            ||
| 159 | 'key' => 'ds_api.user.roles',  | 
            ||
| 160 | 'value' => serialize([])  | 
            ||
| 161 | ],  | 
            ||
| 162 | [  | 
            ||
| 163 | 'key' => 'ds_api.user.identity.roles',  | 
            ||
| 164 | 'value' => serialize([])  | 
            ||
| 165 | ],  | 
            ||
| 166 | [  | 
            ||
| 167 | 'key' => 'ds_api.user.identity.type',  | 
            ||
| 168 |                         'value' => serialize('System') | 
            ||
| 169 | ],  | 
            ||
| 170 | [  | 
            ||
| 171 | 'key' => 'ds_api.user.identity.uuid',  | 
            ||
| 172 | 'value' => serialize($data['identity']['system']['uuid'])  | 
            ||
| 173 | ],  | 
            ||
| 174 | [  | 
            ||
| 175 | 'key' => 'ds_api.user.tenant',  | 
            ||
| 176 | 'value' => serialize($data['tenant']['uuid'])  | 
            ||
| 177 | ]  | 
            ||
| 178 | ];  | 
            ||
| 179 | |||
| 180 |                 foreach ($configs as $config) { | 
            ||
| 181 | $this->addSql(sprintf(  | 
            ||
| 182 | 'INSERT INTO ds_config (id, uuid, owner, owner_uuid, key, value, version, tenant, created_at, updated_at) VALUES (%d, %s, %s, %s, %s, %s, %d, %s, %s, %s);',  | 
            ||
| 183 | ++$i,  | 
            ||
| 184 | $this->connection->quote(Uuid::uuid4()->toString()),  | 
            ||
| 185 |                         $this->connection->quote('BusinessUnit'), | 
            ||
| 186 | $this->connection->quote($data['business_unit']['administration']['uuid']),  | 
            ||
| 187 | $this->connection->quote($config['key']),  | 
            ||
| 188 | $this->connection->quote($config['value']),  | 
            ||
| 189 | 1,  | 
            ||
| 190 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 191 | 'now()',  | 
            ||
| 192 | 'now()'  | 
            ||
| 193 | ));  | 
            ||
| 194 | }  | 
            ||
| 195 | |||
| 196 | $i = 0;  | 
            ||
| 197 | $j = 0;  | 
            ||
| 198 | $accesses = [  | 
            ||
| 199 | [  | 
            ||
| 200 | 'owner' => 'System',  | 
            ||
| 201 | 'owner_uuid' => $data['identity']['system']['uuid'],  | 
            ||
| 202 | 'assignee' => 'System',  | 
            ||
| 203 | 'assignee_uuid' => $data['identity']['system']['uuid'],  | 
            ||
| 204 | 'permissions' => [  | 
            ||
| 205 | [  | 
            ||
| 206 | 'key' => 'entity',  | 
            ||
| 207 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE"]'  | 
            ||
| 208 | ],  | 
            ||
| 209 | [  | 
            ||
| 210 | 'key' => 'property',  | 
            ||
| 211 | 'attributes' => '["BROWSE","READ","EDIT"]'  | 
            ||
| 212 | ],  | 
            ||
| 213 | [  | 
            ||
| 214 | 'key' => 'generic',  | 
            ||
| 215 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE","EXECUTE"]'  | 
            ||
| 216 | ]  | 
            ||
| 217 | ]  | 
            ||
| 218 | ],  | 
            ||
| 219 | [  | 
            ||
| 220 | 'owner' => 'BusinessUnit',  | 
            ||
| 221 | 'owner_uuid' => $data['business_unit']['administration']['uuid'],  | 
            ||
| 222 | 'assignee' => 'Staff',  | 
            ||
| 223 | 'assignee_uuid' => $data['identity']['admin']['uuid'],  | 
            ||
| 224 | 'permissions' => [  | 
            ||
| 225 | [  | 
            ||
| 226 | 'key' => 'entity',  | 
            ||
| 227 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE"]'  | 
            ||
| 228 | ],  | 
            ||
| 229 | [  | 
            ||
| 230 | 'key' => 'property',  | 
            ||
| 231 | 'attributes' => '["BROWSE","READ","EDIT"]'  | 
            ||
| 232 | ],  | 
            ||
| 233 | [  | 
            ||
| 234 | 'key' => 'generic',  | 
            ||
| 235 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE","EXECUTE"]'  | 
            ||
| 236 | ]  | 
            ||
| 237 | ]  | 
            ||
| 238 | ]  | 
            ||
| 239 | ];  | 
            ||
| 240 | |||
| 241 |                 foreach ($accesses as $access) { | 
            ||
| 242 | $this->addSql(sprintf(  | 
            ||
| 243 | 'INSERT INTO ds_access (id, uuid, owner, owner_uuid, assignee, assignee_uuid, version, tenant, created_at, updated_at) VALUES (%d, %s, %s, %s, %s, %s, %d, %s, %s, %s);',  | 
            ||
| 244 | ++$i,  | 
            ||
| 245 | $this->connection->quote(Uuid::uuid4()->toString()),  | 
            ||
| 246 | $this->connection->quote($access['owner']),  | 
            ||
| 247 | $this->connection->quote($access['owner_uuid']),  | 
            ||
| 248 | $this->connection->quote($access['assignee']),  | 
            ||
| 249 | $this->connection->quote($access['assignee_uuid']),  | 
            ||
| 250 | 1,  | 
            ||
| 251 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 252 | 'now()',  | 
            ||
| 253 | 'now()'  | 
            ||
| 254 | ));  | 
            ||
| 255 | |||
| 256 |                     foreach ($access['permissions'] as $permission) { | 
            ||
| 257 | $this->addSql(sprintf(  | 
            ||
| 258 | 'INSERT INTO ds_access_permission (id, access_id, scope, entity, entity_uuid, key, attributes, tenant) VALUES (%d, %d, %s, %s, %s, %s, %s, %s);',  | 
            ||
| 259 | ++$j,  | 
            ||
| 260 | $i,  | 
            ||
| 261 |                             $this->connection->quote('generic'), | 
            ||
| 262 | 'NULL',  | 
            ||
| 263 | 'NULL',  | 
            ||
| 264 | $this->connection->quote($permission['key']),  | 
            ||
| 265 | $this->connection->quote($permission['attributes']),  | 
            ||
| 266 | $this->connection->quote($data['tenant']['uuid'])  | 
            ||
| 267 | ));  | 
            ||
| 268 | }  | 
            ||
| 269 | }  | 
            ||
| 270 | |||
| 271 | break;  | 
            ||
| 272 | |||
| 273 | default:  | 
            ||
| 274 | $this->abortIf(true,'Migration cannot be executed on "'.$platform.'".');  | 
            ||
| 275 | break;  | 
            ||
| 276 | }  | 
            ||
| 336 |