You are here

class TeamInvitationSubscriber in Apigee Edge 8

Same name in this branch
  1. 8 modules/apigee_edge_teams/src/EventSubscriber/TeamInvitationSubscriber.php \Drupal\apigee_edge_teams\EventSubscriber\TeamInvitationSubscriber
  2. 8 modules/apigee_edge_teams/tests/modules/apigee_edge_teams_invitation_test/src/EventSubscriber/TeamInvitationSubscriber.php \Drupal\apigee_edge_teams_invitation_test\EventSubscriber\TeamInvitationSubscriber

Defines a subscriber for team_invitation events.

Hierarchy

  • class \Drupal\apigee_edge_teams_invitation_test\EventSubscriber\TeamInvitationSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of TeamInvitationSubscriber

1 string reference to 'TeamInvitationSubscriber'
apigee_edge_teams_invitation_test.services.yml in modules/apigee_edge_teams/tests/modules/apigee_edge_teams_invitation_test/apigee_edge_teams_invitation_test.services.yml
modules/apigee_edge_teams/tests/modules/apigee_edge_teams_invitation_test/apigee_edge_teams_invitation_test.services.yml
1 service uses TeamInvitationSubscriber
apigee_edge_teams_invitation_test.event_subscriber.team_invitation_subscriber in modules/apigee_edge_teams/tests/modules/apigee_edge_teams_invitation_test/apigee_edge_teams_invitation_test.services.yml
\Drupal\apigee_edge_teams_invitation_test\EventSubscriber\TeamInvitationSubscriber

File

modules/apigee_edge_teams/tests/modules/apigee_edge_teams_invitation_test/src/EventSubscriber/TeamInvitationSubscriber.php, line 31

Namespace

Drupal\apigee_edge_teams_invitation_test\EventSubscriber
View source
class TeamInvitationSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[TeamInvitationEvents::CREATED][] = 'onCreated';
    $events[TeamInvitationEvents::DECLINED][] = 'onDeclined';
    $events[TeamInvitationEvents::ACCEPTED][] = 'onAccepted';
    return $events;
  }

  /**
   * Callback for on created event.
   *
   * @param \Drupal\apigee_edge_teams\Event\TeamInvitationEventInterface $event
   *   The event.
   */
  public function onCreated(TeamInvitationEventInterface $event) {
    $team_invitation = $event
      ->getTeamInvitation();
    $team_invitation
      ->setLabel("CREATED")
      ->save();
  }

  /**
   * Callback for on declined event.
   *
   * @param \Drupal\apigee_edge_teams\Event\TeamInvitationEventInterface $event
   *   The event.
   */
  public function onDeclined(TeamInvitationEventInterface $event) {
    $team_invitation = $event
      ->getTeamInvitation();
    $team_invitation
      ->setLabel("DECLINED")
      ->save();
  }

  /**
   * Callback for on accepted event.
   *
   * @param \Drupal\apigee_edge_teams\Event\TeamInvitationEventInterface $event
   *   The event.
   */
  public function onAccepted(TeamInvitationEventInterface $event) {
    $team_invitation = $event
      ->getTeamInvitation();
    $team_invitation
      ->setLabel("ACCEPTED")
      ->save();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TeamInvitationSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
TeamInvitationSubscriber::onAccepted public function Callback for on accepted event.
TeamInvitationSubscriber::onCreated public function Callback for on created event.
TeamInvitationSubscriber::onDeclined public function Callback for on declined event.