AcsfDuplicationScrubNodeHandler.php in Acquia Cloud Site Factory Connector 8
File
src/Event/AcsfDuplicationScrubNodeHandler.php
View source
<?php
namespace Drupal\acsf\Event;
class AcsfDuplicationScrubNodeHandler extends AcsfDuplicationScrubEntityHandler {
public function __construct(AcsfEvent $event) {
$this->entityTypeId = 'node';
parent::__construct($event);
}
public function handle() {
$options = $this->event->context['scrub_options'];
if ($options['retain_content']) {
drush_print(dt('Entered @class', [
'@class' => get_class($this),
]));
return;
}
parent::handle();
}
protected function getBaseQuery() {
$entity_query = parent::getBaseQuery();
$entity_query
->condition('uid', $this
->getPreservedUsers(), 'NOT IN');
return $entity_query;
}
protected function getPreservedUsers() {
$preserved_uids = parent::getPreservedUsers();
if (($key = array_search(0, $preserved_uids)) !== FALSE) {
unset($preserved_uids[$key]);
}
return $preserved_uids;
}
}