public function ContentImporter::validateEntity in Content Synchronization 3.0.x
Same name and namespace in other branches
- 8.2 src/Importer/ContentImporter.php \Drupal\content_sync\Importer\ContentImporter::validateEntity()
1 call to ContentImporter::validateEntity()
- ContentImporter::syncEntity in src/
Importer/ ContentImporter.php - Synchronize a given entity.
File
- src/
Importer/ ContentImporter.php, line 320
Class
Namespace
Drupal\content_sync\ImporterCode
public function validateEntity(ContentEntityInterface $entity) {
$reflection = new \ReflectionClass($entity);
$valid = TRUE;
if ($reflection
->implementsInterface('\\Drupal\\user\\UserInterface')) {
$validations = $entity
->validate();
if (count($validations)) {
/**
* @var ConstraintViolation $validation
*/
foreach ($validations as $validation) {
if (!empty($this
->getContext()['skipped_constraints']) && in_array(get_class($validation
->getConstraint()), $this
->getContext()['skipped_constraints'])) {
continue;
}
$valid = FALSE;
\Drupal::logger('content_sync')
->error($validation
->getMessage());
}
}
}
return $valid;
}