public function ReplicationLogNormalizer::supportsDenormalization in Replication 8
Same name and namespace in other branches
- 8.2 src/Normalizer/ReplicationLogNormalizer.php \Drupal\replication\Normalizer\ReplicationLogNormalizer::supportsDenormalization()
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
This class doesn't implement DenormalizerInterface, but most of its child classes do. Therefore, this method is implemented at this level to reduce code duplication.
Overrides NormalizerBase::supportsDenormalization
File
- src/
Normalizer/ ReplicationLogNormalizer.php, line 86
Class
Namespace
Drupal\replication\NormalizerCode
public function supportsDenormalization($data, $type, $format = NULL) {
// We need to accept both ReplicationLog and ContentEntityInterface classes.
// LocalDocResource entities are treated as standard documents (content entities)
if (in_array($type, [
'Drupal\\Core\\Entity\\ContentEntityInterface',
'Drupal\\replication\\Entity\\ReplicationLog',
], true)) {
// If a document doesn't have a type set, we assume it's a replication log.
// We also support documents specifically specified as replication logs.
if (!isset($data['@type']) || $data['@type'] === 'replication_log') {
return true;
}
}
return false;
}