You are here

class InviteParamConverter in Invite 8

Class InviteParamConverter.

Hierarchy

Expanded class hierarchy of InviteParamConverter

1 string reference to 'InviteParamConverter'
invite.services.yml in ./invite.services.yml
invite.services.yml
1 service uses InviteParamConverter
reg_code in ./invite.services.yml
Drupal\invite\ParamConverter\InviteParamConverter

File

src/ParamConverter/InviteParamConverter.php, line 12

Namespace

Drupal\invite\ParamConverter
View source
class InviteParamConverter implements ParamConverterInterface {

  /**
   * Applies function.
   */
  public function applies($definition, $name, Route $route) {
    return !empty($definition['type']) && $definition['type'] == 'reg_code';
  }

  /**
   * Converts reg_code to invite.
   */
  public function convert($reg_code, $definition, $name, array $defaults) {
    $invite = \Drupal::entityQuery('invite')
      ->condition('reg_code', $reg_code)
      ->execute();
    return Invite::load(reset($invite));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InviteParamConverter::applies public function Applies function. Overrides ParamConverterInterface::applies
InviteParamConverter::convert public function Converts reg_code to invite. Overrides ParamConverterInterface::convert