public function updateDrushAliases(EnvironmentsChangedEvent $event)
{
$projectRoot = $this->getProjectRoot();
if (!$projectRoot) {
return;
}
// Double-check that the passed project is the current one.
$currentProject = $this->getCurrentProject();
if (!$currentProject || $currentProject->id != $event->getProject()->id) {
return;
}
// Ignore the project if it doesn't contain a Drupal application.
if (!Drupal::isDrupal($projectRoot)) {
return;
}
$this->debug('Updating Drush aliases');
/** @var \Platformsh\Cli\Helper\DrushHelper $drushHelper */
$drushHelper = $this->getHelper('drush');
$drushHelper->setHomeDir($this->getHomeDir());
$drushHelper->createAliases($event->getProject(), $projectRoot, $event->getEnvironments());
}