You are here

WebformSubmissionCastToNumberTrait.php in Webform Views Integration 8.5

File

src/Plugin/views/WebformSubmissionCastToNumberTrait.php
View source
<?php

namespace Drupal\webform_views\Plugin\views;


/**
 * Trait to cast a SQL expression to numeric data type.
 */
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)";
  }

}

Traits

Namesort descending Description
WebformSubmissionCastToNumberTrait Trait to cast a SQL expression to numeric data type.