You are here

trait WebformSubmissionCastToNumberTrait in Webform Views Integration 8.5

Trait to cast a SQL expression to numeric data type.

Hierarchy

3 files declare their use of WebformSubmissionCastToNumberTrait
WebformSubmissionFieldNumeric.php in src/Plugin/views/field/WebformSubmissionFieldNumeric.php
WebformSubmissionFieldNumericSort.php in src/Plugin/views/sort/WebformSubmissionFieldNumericSort.php
WebformSubmissionNumericFilter.php in src/Plugin/views/filter/WebformSubmissionNumericFilter.php

File

src/Plugin/views/WebformSubmissionCastToNumberTrait.php, line 8

Namespace

Drupal\webform_views\Plugin\views
View source
trait WebformSubmissionCastToNumberTrait {

  /**
   * Cast a given SQL snippet to data type expected by this handler.
   *
   * @param string $value
   *   SQL snippet that should be casted
   *
   * @return string
   *   SQL snippet that casts provided $value to necessary data type
   */
  protected function castToDataType($value) {
    return "({$value} + 0)";
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WebformSubmissionCastToNumberTrait::castToDataType protected function Cast a given SQL snippet to data type expected by this handler.