You are here

public static function RoutingTransactionNameSubscriber::nodeAddTransactionName in New Relic 8

Same name and namespace in other branches
  1. 2.x src/EventSubscriber/RoutingTransactionNameSubscriber.php \Drupal\new_relic_rpm\EventSubscriber\RoutingTransactionNameSubscriber::nodeAddTransactionName()
  2. 2.0.x src/EventSubscriber/RoutingTransactionNameSubscriber.php \Drupal\new_relic_rpm\EventSubscriber\RoutingTransactionNameSubscriber::nodeAddTransactionName()

Get the transaction name for an "node.add" route.

1 call to RoutingTransactionNameSubscriber::nodeAddTransactionName()
RoutingTransactionNameSubscriberTest::testNodeAddRouteTransactionName in tests/src/Unit/EventListener/RoutingTransactionNameSubscriberTest.php
@covers ::nodeAddTransactionName

File

src/EventSubscriber/RoutingTransactionNameSubscriber.php, line 82

Class

RoutingTransactionNameSubscriber
Enhances routes with a transaction name or transaction name callback.

Namespace

Drupal\new_relic_rpm\EventSubscriber

Code

public static function nodeAddTransactionName(Request $request) {
  $name = $request->attributes
    ->get('_transaction_name');
  if (($node_type = $request->attributes
    ->get('node_type')) && $node_type instanceof EntityInterface) {
    return sprintf('%s:%s', $name, $node_type
      ->id());
  }
  return $name;
}