Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / views / src / Plugin / views / query / DateSqlInterface.php
1 <?php
2
3 namespace Drupal\views\Plugin\views\query;
4
5 /**
6  * Defines an interface for handling date queries with SQL.
7  *
8  * @internal
9  *   Classes implementing this interface should only be used by the Views SQL
10  *   query plugin.
11  *
12  * @see \Drupal\views\Plugin\views\query\Sql
13  */
14 interface DateSqlInterface {
15
16   /**
17    * Returns a native database expression for a given field.
18    *
19    * @param string $field
20    *   The query field that will be used in the expression.
21    * @param bool $string_date
22    *   For certain databases, date format functions vary depending on string or
23    *   numeric storage.
24    *
25    * @return string
26    *   An expression representing a date field with timezone.
27    */
28   public function getDateField($field, $string_date);
29
30   /**
31    * Creates a native database date formatting.
32    *
33    * @param string $field
34    *   An appropriate query expression pointing to the date field.
35    * @param string $format
36    *   A format string for the result. For example: 'Y-m-d H:i:s'.
37    *
38    * @return string
39    *   A string representing the field formatted as a date as specified by
40    *   $format.
41    */
42   public function getDateFormat($field, $format);
43
44   /**
45    * Applies the given offset to the given field.
46    *
47    * @param string &$field
48    *   The date field in a string format.
49    * @param int $offset
50    *   The timezone offset in seconds.
51    */
52   public function setFieldTimezoneOffset(&$field, $offset);
53
54   /**
55    * Set the database to the given timezone.
56    *
57    * @param string $offset
58    *   The timezone.
59    */
60   public function setTimezoneOffset($offset);
61
62 }