/** * @param LoggerInterface $logger * @param bool $dryRun */ protected function runActivityLists(LoggerInterface $logger, $dryRun = false) { $this->configManager->clearModelCache(); $targetEntities = $this->provider->getTargetEntityClasses(); $toSchema = clone $this->schema; $hasSchemaChanges = false; foreach ($targetEntities as $targetEntity) { $associationName = ExtendHelper::buildAssociationName($targetEntity, ActivityListEntityConfigDumperExtension::ASSOCIATION_KIND); $relationTableName = $this->nameGenerator->generateManyToManyJoinTableName(ActivityListEntityConfigDumperExtension::ENTITY_CLASS, $associationName, $targetEntity); if (!$toSchema->hasTable($relationTableName)) { $hasSchemaChanges = true; $this->activityListExtension->addActivityListAssociation($toSchema, $this->metadataHelper->getTableNameByEntityClass($targetEntity)); } } if ($hasSchemaChanges) { $comparator = new Comparator(); $platform = $this->connection->getDatabasePlatform(); $schemaDiff = $comparator->compare($this->schema, $toSchema); $queries = $schemaDiff->toSql($platform); foreach ($queries as $query) { $this->logQuery($logger, $query); if (!$dryRun) { $this->connection->executeQuery($query); } } } }