Get by price type ID
@param Offer $obQuery
@param int   $sData

@return Offer
359608
public function scopeGetByPriceType($obQuery, $sData)
    {
        if (!empty($sData)) {
            $obQuery->where('price_type_id', $sData);
        } else {
            $obQuery->whereNull('price_type_id');
        }

        return $obQuery;
    }
1242642
private TransactionalDataSource getTransactionalDataSource(
            ODataRequestContext odataRequestContext, Type type) throws ODataException {
        DataSource dataSource = dataSourceFactory.getDataSource(odataRequestContext, type.getFullyQualifiedName());
        String dataSourceKey = dataSource.getClass().toString();
        if (dataSourceMap.containsKey(dataSourceKey)) {
            return dataSourceMap.get(dataSourceKey);
        } else {
            TransactionalDataSource transactionalDataSource = dataSource.startTransaction();

            dataSourceMap.put(dataSourceKey, transactionalDataSource);
            return transactionalDataSource;
        }
    }
1165337
public OvhOrder overTheBox_new_duration_GET(String duration, String deviceId, String offer, String voucher) throws IOException {
		String qPath = "/order/overTheBox/new/{duration}";
		StringBuilder sb = path(qPath, duration);
		query(sb, "deviceId", deviceId);
		query(sb, "offer", offer);
		query(sb, "voucher", voucher);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhOrder.class);
	}
1161693
function ( sData )
		{
			var iParse = Date.parse(sData);
			if ( (iParse !== null && !isNaN(iParse)) || (typeof sData === 'string' && sData.length === 0) )
			{
				return 'date';
			}
			return null;
		}
691050
public function getResultSet($cdbxml)
    {
        $items = new OfferIdentifierCollection();
        $totalItems = $cdbId = $elementName = $offerType = $resultXmlString = null;

        $resetCurrentResultValues = function () use (&$cdbId, &$elementName, &$offerType, &$resultXmlString) {
            $cdbId = null;
            $elementName = self::CDBXML_TYPE_UNKNOWN;
            $offerType = self::OFFER_TYPE_UNKNOWN;
            $resultXmlString = '';
        };

        $resetCurrentResultValues();

        $r = $this->xmlReader;
        $r->xml($cdbxml);

        while ($r->read()) {
            if ($this->xmlNodeIsNumberOfRecordsTag($r)) {
                $totalItems = new Integer((int) $r->readString());
            }

            if ($this->xmlNodeIsResultOpeningTag($r)) {
                $resultXmlString = $r->readOuterXml();
                $cdbId = $r->getAttribute('cdbid');
                $elementName = 'cdbxml.' . $r->localName;

                if ($elementName == self::CDBXML_TYPE_EVENT) {
                    $offerType = self::OFFER_TYPE_EVENT;
                }
            }

            if ($this->xmlNodeIsUdb3PlaceKeyword($r) && $elementName == self::CDBXML_TYPE_EVENT) {
                $offerType = self::OFFER_TYPE_PLACE;
            }

            if ($this->xmlNodeIsLocationCategory($r) && $elementName == self::CDBXML_TYPE_ACTOR) {
                $offerType = self::OFFER_TYPE_PLACE;
            }

            if ($this->xmlNodeIsResultClosingTag($r)) {
                if ($offerType == self::OFFER_TYPE_UNKNOWN) {
                    // Skip if we haven't been able to deduce an offer type.
                    // (Eg. actor, but without the place category.)
                    continue;
                }

                if (empty($cdbId)) {
                    // Skip if no cdbid found.
                    continue;
                }

                // Null if attribute not set, empty string if not found in the search index.
                $externalUrl = $r->getAttribute('externalurl');
                if (empty($externalUrl)) {
                    $iriGenerator = $this->fallbackIriGenerators[$offerType];
                    $externalUrl = $iriGenerator->iri($cdbId);

                    $this->logger->debug(
                        "Created fallback url for search result {$cdbId}, with cdbxml: {$resultXmlString}"
                    );
                }

                $items = $items->with(
                    new IriOfferIdentifier(
                        Url::fromNative($externalUrl),
                        $cdbId,
                        $this->getOfferTypeEnum($offerType)
                    )
                );

                $resetCurrentResultValues();
            }
        }

        return new Results($items, $totalItems);
    }
937223
private function makeEntityQuery(
      $options,
      $selectors,
      $etypeDirty,
      $subquery = false
  ) {
    $fullQueryCoverage = true;
    $sort = $options['sort'] ?? 'cdate';
    $etype = '_'.mysqli_real_escape_string($this->link, $etypeDirty);
    $queryParts = $this->iterateSelectorsForQuery($selectors, function ($value) use ($options, $etypeDirty, &$fullQueryCoverage) {
      $subquery = $this->makeEntityQuery(
          $options,
          [$value],
          $etypeDirty,
          true
      );
      $fullQueryCoverage = $fullQueryCoverage && $subquery['fullCoverage'];
      return $subquery['query'];
    }, function (&$curQuery, $key, $value, $typeIsOr, $typeIsNot) use ($etype, &$fullQueryCoverage) {
      $clauseNot = $key[0] === '!';
      // Any options having to do with data only return if the
      // entity has the specified variables.
      foreach ($value as $curValue) {
        switch ($key) {
          case 'guid':
          case '!guid':
            foreach ($curValue as $curGuid) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`guid`=\''.(int) $curGuid.'\'';
            }
            break;
          case 'tag':
          case '!tag':
            if ($typeIsNot xor $clauseNot) {
              if ($typeIsOr) {
                foreach ($curValue as $curTag) {
                  if ($curQuery) {
                    $curQuery .= ' OR ';
                  }
                  $curQuery .= 'ie.`tags` NOT REGEXP \' '.
                      mysqli_real_escape_string($this->link, $curTag).
                      ' \'';
                }
              } else {
                $curQuery .= 'ie.`tags` NOT REGEXP \' ('.
                    mysqli_real_escape_string(
                        $this->link,
                        implode('|', $curValue)
                    ).') \'';
              }
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $groupQuery = '';
              foreach ($curValue as $curTag) {
                $groupQuery .= ($typeIsOr ? ' ' : ' +').
                    '"'.mysqli_real_escape_string($this->link, $curTag).'"';
              }
              $curQuery .= 'MATCH (ie.`tags`) AGAINST (\''.
                  $groupQuery.'\' IN BOOLEAN MODE)';
            }
            break;
          case 'isset':
          case '!isset':
            foreach ($curValue as $curVar) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'data',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curVar).
                      '\' AND `value`!=\'N;\'',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'ref':
          case '!ref':
            $guids = [];
            if (is_array($curValue[1])) {
              if (key_exists('guid', $curValue[1])) {
                $guids[] = (int) $curValue[1]['guid'];
              } else {
                foreach ($curValue[1] as $curEntity) {
                  if (is_object($curEntity)) {
                    $guids[] = (int) $curEntity->guid;
                  } elseif (is_array($curEntity)) {
                    $guids[] = (int) $curEntity['guid'];
                  } else {
                    $guids[] = (int) $curEntity;
                  }
                }
              }
            } elseif (is_object($curValue[1])) {
              $guids[] = (int) $curValue[1]->guid;
            } else {
              $guids[] = (int) $curValue[1];
            }
            foreach ($guids as $curQguid) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'references',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `reference`='.
                      mysqli_real_escape_string($this->link, (int) $curQguid),
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'strict':
          case '!strict':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`cdate`='.((float) $curValue[1]);
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`mdate`='.((float) $curValue[1]);
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              if (is_callable([$curValue[1], 'toReference'])) {
                $svalue = serialize($curValue[1]->toReference());
              } else {
                $svalue = serialize($curValue[1]);
              }
              $curQuery .= $this->makeDataPart(
                  'data',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `value`=\''.
                      mysqli_real_escape_string($this->link, $svalue).'\'',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'like':
          case '!like':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`cdate` LIKE \''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\')';
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`mdate` LIKE \''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\')';
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `string` LIKE \''.
                      mysqli_real_escape_string($this->link, $curValue[1]).
                      '\'',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'ilike':
          case '!ilike':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`cdate` LIKE LOWER(\''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\'))';
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`mdate` LIKE LOWER(\''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\'))';
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND LOWER(`string`) LIKE LOWER(\''.
                      mysqli_real_escape_string($this->link, $curValue[1]).
                      '\')',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'pmatch':
          case '!pmatch':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`cdate` REGEXP \''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\')';
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`mdate` REGEXP \''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\')';
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `string` REGEXP \''.
                      mysqli_real_escape_string($this->link, $curValue[1]).
                      '\'',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'ipmatch':
          case '!ipmatch':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`cdate` REGEXP LOWER(\''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\'))';
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  '(ie.`mdate` REGEXP LOWER(\''.
                  mysqli_real_escape_string($this->link, $curValue[1]).
                  '\'))';
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND LOWER(`string`) REGEXP LOWER(\''.
                      mysqli_real_escape_string($this->link, $curValue[1]).
                      '\')',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'gt':
          case '!gt':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`cdate`>'.((float) $curValue[1]);
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`mdate`>'.((float) $curValue[1]);
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND ((`is_int`=TRUE AND `int` > '.
                      ((int) $curValue[1]).') OR ('.
                      '`is_int`=FALSE AND `float` > '.
                      ((float) $curValue[1]).'))',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'gte':
          case '!gte':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`cdate`>='.((float) $curValue[1]);
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`mdate`>='.((float) $curValue[1]);
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND ((`is_int`=TRUE AND `int` >= '.
                      ((int) $curValue[1]).') OR ('.
                      '`is_int`=FALSE AND `float` >= '.
                      ((float) $curValue[1]).'))',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'lt':
          case '!lt':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`cdate`<'.((float) $curValue[1]);
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`mdate`<'.((float) $curValue[1]);
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND ((`is_int`=TRUE AND `int` < '.
                      ((int) $curValue[1]).') OR ('.
                      '`is_int`=FALSE AND `float` < '.
                      ((float) $curValue[1]).'))',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          case 'lte':
          case '!lte':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`cdate`<='.((float) $curValue[1]);
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie.`mdate`<='.((float) $curValue[1]);
              break;
            } else {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND ((`is_int`=TRUE AND `int` <= '.
                      ((int) $curValue[1]).') OR ('.
                      '`is_int`=FALSE AND `float` <= '.
                      ((float) $curValue[1]).'))',
                  $typeIsNot xor $clauseNot
              );
            }
            break;
          // Cases after this point contains special values where
          // it can be solved by the query, but if those values
          // don't match, just check the variable exists.
          case 'equal':
          case '!equal':
          case 'data':
          case '!data':
            if ($curValue[0] === 'cdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie."cdate"='.((float) $curValue[1]);
              break;
            } elseif ($curValue[0] === 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= (($typeIsNot xor $clauseNot) ? 'NOT ' : '').
                  'ie."mdate"='.((float) $curValue[1]);
              break;
            } elseif ($curValue[1] === true || $curValue[1] === false) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `eq_true`='.($curValue[1] ? 'TRUE' : 'FALSE'),
                  $typeIsNot xor $clauseNot
              );
              break;
            } elseif ($curValue[1] === 1) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `eq_one`=TRUE',
                  $typeIsNot xor $clauseNot
              );
              break;
            } elseif ($curValue[1] === 0) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `eq_zero`=TRUE',
                  $typeIsNot xor $clauseNot
              );
              break;
            } elseif ($curValue[1] === -1) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `eq_negone`=TRUE',
                  $typeIsNot xor $clauseNot
              );
              break;
            } elseif ($curValue[1] === []) {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'comparisons',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).
                      '\' AND `eq_emptyarray`=TRUE',
                  $typeIsNot xor $clauseNot
              );
              break;
            }
            // Fall through.
          case 'match':
          case '!match':
          case 'array':
          case '!array':
            if (!($typeIsNot xor $clauseNot) && $curValue[0] !== 'cdate' && $curValue[0] !== 'mdate') {
              if ($curQuery) {
                $curQuery .= $typeIsOr ? ' OR ' : ' AND ';
              }
              $curQuery .= $this->makeDataPart(
                  'data',
                  $etype,
                  '`name`=\''.
                      mysqli_real_escape_string($this->link, $curValue[0]).'\'',
                  $typeIsNot xor $clauseNot
              );
            }
            $fullQueryCoverage = false;
            break;
        }
      }
    });

    switch ($sort) {
      case 'guid':
        $sort = '`guid`';
        break;
      case 'mdate':
        $sort = '`mdate`';
        break;
      case 'cdate':
      default:
        $sort = '`cdate`';
        break;
    }
    if (isset($options['reverse']) && $options['reverse']) {
      $sort .= ' DESC';
    }

    if ($queryParts) {
      if ($subquery) {
        $query = "((".implode(') AND (', $queryParts)."))";
      } else {
        $limit = "";
        if ($fullQueryCoverage && key_exists('limit', $options)) {
          $limit = " LIMIT ".((int) $options['limit']);
        }
        $offset = "";
        if ($fullQueryCoverage && key_exists('offset', $options)) {
          $offset = " OFFSET ".((int) $options['offset']);
        }
        $query =
          "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ".
            "d.`name`, d.`value` ".
          "FROM `{$this->prefix}entities{$etype}` e ".
          "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ".
          "INNER JOIN (".
            "SELECT ie.`guid` FROM `{$this->prefix}entities{$etype}` ie ".
            "WHERE (".
              implode(') AND (', $queryParts).
            ") ".
            "ORDER BY ie.{$sort}{$limit}{$offset}".
          ") f ON e.`guid`=f.`guid` ".
          "ORDER BY e.{$sort};";
      }
    } else {
      if ($subquery) {
        $query = '';
      } else {
        $limit = "";
        if (key_exists('limit', $options)) {
          $limit = " LIMIT ".((int) $options['limit']);
        }
        $offset = "";
        if (key_exists('offset', $options)) {
          $offset = " OFFSET ".((int) $options['offset']);
        }
        if ($limit || $offset) {
          $query =
            "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ".
              "d.`name`, d.`value` ".
            "FROM `{$this->prefix}entities{$etype}` e ".
            "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ".
            "INNER JOIN (".
              "SELECT ie.`guid` ".
              "FROM `{$this->prefix}entities{$etype}` ie ".
              "ORDER BY ie.{$sort}{$limit}{$offset}".
            ") f ON e.`guid`=f.`guid` ".
            "ORDER BY e.{$sort};";
        } else {
          $query =
            "SELECT e.`guid`, e.`tags`, e.`cdate`, e.`mdate`, ".
              "d.`name`, d.`value` ".
            "FROM `{$this->prefix}entities{$etype}` e ".
            "LEFT JOIN `{$this->prefix}data{$etype}` d ON e.`guid`=d.`guid` ".
            "ORDER BY e.{$sort};";
        }
      }
    }

    return [
      'fullCoverage' => $fullQueryCoverage,
      'limitOffsetCoverage' => $fullQueryCoverage,
      'query' => $query
    ];
  }
633699
public function getDiscountValue($dPrice)
    {
        if ($this->_isProductVoucher()) {
            return $this->_getProductDiscountValue((double) $dPrice);
        } elseif ($this->_isCategoryVoucher()) {
            return $this->_getCategoryDiscountValue((double) $dPrice);
        } else {
            return $this->_getGenericDiscountValue((double) $dPrice);
        }
    }
239576
public static function GetNewInstance($sData = null, $sLanguage = null)
    {
        $oInstance = parent::GetNewInstance($sData, $sLanguage);
        if ($oInstance && is_array($oInstance->sqlData)) {
            if (!empty($oInstance->sqlData['class_name'])) {
                $sClassName = $oInstance->sqlData['class_name'];
                $oNewInstance = new $sClassName();
                $oNewInstance->LoadFromRow($oInstance->sqlData);
                $oInstance = $oNewInstance;
            }
        }

        return $oInstance;
    }
213023
public OvhPrice overTheBox_offer_offerName_GET(net.minidev.ovh.api.price.overthebox.OvhOfferEnum offerName) throws IOException {
		String qPath = "/price/overTheBox/offer/{offerName}";
		StringBuilder sb = path(qPath, offerName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhPrice.class);
	}
424842
public function calculate($oBasket)
    {
        //getting basket price with applied discounts and vouchers
        $dPrice = $this->getPaymentValue($this->getBaseBasketPriceForPaymentCostCalc($oBasket));

        if (!$dPrice) {
            $dPrice = 0;
        }
        // calculating total price
        $oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
        $oPrice->setNettoMode($this->_blPaymentVatOnTop);

        $oPrice->setPrice($dPrice);
        if ($dPrice > 0) {
            $oPrice->setVat($oBasket->getAdditionalServicesVatPercent());
        }

        $this->_oPrice = $oPrice;
    }
209965
public OvhPrice price_GET(String flavorId, String region) throws IOException {
		String qPath = "/cloud/price";
		StringBuilder sb = path(qPath);
		query(sb, "flavorId", flavorId);
		query(sb, "region", region);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhPrice.class);
	}
973659
public function getAbsValue($dPrice, $dAmount = 1)
    {
        if ($this->oxdiscount__oxaddsumtype->value == '%') {
            return $dPrice * ($this->oxdiscount__oxaddsum->value / 100);
        } else {
            $oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();

            return $this->oxdiscount__oxaddsum->value * $dAmount * $oCur->rate;
        }
    }
942057
public JSONObject getRoomByOffer(String company, String offerId, HashMap<String, String> params) throws JSONException {
        return oClient.get("/messages/v3/" + company + "/rooms/offers/" + offerId, params);
    }
595514
def getBids(self, auction_id):
        """"""
        bids = {}
        rc = self.__ask__('doGetBidItem2', itemId=auction_id)
        if rc:
            for i in rc:
                i = i['bidsArray']
                bids[long(i['item'][1])] = {
                    'price': Decimal(i['item'][6]),
                    'quantity': int(i['item'][5]),
                    'date_buy': i['item'][7]
                }
        return bids
527820
public function add($offer)
    {
        if (is_array($offer)) {
            $this->collection[] = new MarketModelOffer($offer);
        } elseif ($offer instanceof MarketModelOffer) {
            $this->collection[] = $offer;
        }

        return $this;
    }
317747
protected function _getVendor($oArticle, $iLang)
    {
        $oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();

        $oVendor = null;
        if ($sActVendorId = $oArticle->oxarticles__oxvendorid->value) {
            if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController && ($oActVendor = $oView->getActVendor())) {
                $oVendor = $oActVendor;
            } else {
                $oVendor = oxNew(\OxidEsales\Eshop\Application\Model\Vendor::class);
            }
            if ($oVendor->getId() !== $sActVendorId) {
                $oVendor = oxNew(\OxidEsales\Eshop\Application\Model\Vendor::class);
                if (!$oVendor->loadInLang($iLang, $sActVendorId)) {
                    $oVendor = null;
                }
            }
        }

        return $oVendor;
    }
1247212
public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher)
    {
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();
        $iAmount = 0;
        while ($oItem = &$this->Next()) {
            $bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem);
            if ($bIncludeProduct) {
                $iAmount = $iAmount + $oItem->dAmount;
            }
        }
        $this->setItemPointer($iCurrentPosition);

        return $iAmount;
    }