|
|
@@ -68,12 +68,20 @@ class PostUpgradeCommand extends Command
|
|
|
}
|
|
|
|
|
|
$this->logger->info('Populate Subdomain table from openassos.sys_domain');
|
|
|
- $sql = "INSERT INTO opentalent.Subdomain (organization_id, subdomain)
|
|
|
- SELECT o.id, REGEXP_REPLACE(d.domainName, '^(.+)\\\\.opentalent\\\\.fr$', '\\\\1')
|
|
|
+
|
|
|
+ $sql = "SELECT d.pid, REGEXP_REPLACE(d.domainName, '^(.+)\\\\.opentalent\\\\.fr$', '\\\\1')
|
|
|
FROM openassos.sys_domain d
|
|
|
- inner join opentalent.Organization o on o.cmsId = d.pid
|
|
|
where d.domainName like '%.opentalent.fr';";
|
|
|
- $cnn->query($sql);
|
|
|
+ $statement = $cnn->query($sql);
|
|
|
+
|
|
|
+ foreach ($statement->fetchAll() as $row) {
|
|
|
+ [$cmsId, $subdomain] = $row;
|
|
|
+ $sql = "INSERT INTO opentalent.Subdomain (organization_id, subdomain)
|
|
|
+ SELECT o.id, " . $subdomain . "
|
|
|
+ from opentalent.Organization o
|
|
|
+ where o.cmsId = " . $cmsId . ";";
|
|
|
+ $cnn->query($sql);
|
|
|
+ }
|
|
|
|
|
|
$sql = "delete
|
|
|
from opentalent.Subdomain
|