EntityCloneServiceProvider.php in Entity Clone 8
File
src/Services/EntityCloneServiceProvider.php
View source
<?php
namespace Drupal\entity_clone\Services;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\EntityOwnerTrait;
class EntityCloneServiceProvider {
public function __construct() {
}
public function entityTypeHasOwnerTrait(EntityTypeInterface $entityType) {
try {
$reflectionClass = new \ReflectionClass($entityType
->getOriginalClass());
} catch (\ReflectionException $e) {
return FALSE;
}
return in_array(EntityOwnerTrait::class, array_keys($reflectionClass
->getTraits()));
}
}