Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings in class.Utils.php #1129

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions core/kernel/persistence/smoothsql/class.Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public static function buildPropertyQuery(
$sqlLang = ' AND (' . self::buildLanguagePattern($persistence, $lang) . ')';
}

$query = "SELECT DISTINCT subject FROM statements WHERE (predicate = ${predicate}) AND (${sqlValues}${sqlLang})"
$query = "SELECT DISTINCT subject FROM statements WHERE (predicate = {$predicate}) AND ({$sqlValues}{$sqlLang})"
. ' AND modelid IN (' . implode(',', $model->getReadableModels()) . ')';

return $query;
Expand All @@ -244,7 +244,7 @@ public static function buildLanguagePattern(common_persistence_SqlPersistence $p
if (empty($lang) === false) {
$sqlEmpty = $persistence->quote('');
$sqlLang = $persistence->quote($lang);
$languagePattern = "l_language = ${sqlEmpty} OR l_language = ${sqlLang}";
$languagePattern = "l_language = {$sqlEmpty} OR l_language = {$sqlLang}";
}

return $languagePattern;
Expand All @@ -261,7 +261,7 @@ public static function buildUnionQuery($propertyQueries)
// Add parenthesis.
$finalPropertyQueries = [];
foreach ($propertyQueries as $query) {
$finalPropertyQueries[] = "(${query})";
$finalPropertyQueries[] = "({$query})";
}

return implode(' UNION ALL ', $finalPropertyQueries);
Expand Down Expand Up @@ -305,7 +305,7 @@ public static function buildFilterQuery(
$query = self::buildPropertyQuery($model, OntologyRdf::RDF_TYPE, $classUri, false, $lang);
} else {
$unionCount = ($and === true) ? ($propCount + 1) : 2;
$query = "SELECT subject FROM (${unionQuery}) AS unionq GROUP BY subject HAVING count(*) >= ${unionCount}";
$query = "SELECT subject FROM ({$unionQuery}) AS unionq GROUP BY subject HAVING count(*) >= {$unionCount}";
}

// Order...
Expand All @@ -316,17 +316,17 @@ public static function buildFilterQuery(
if (!empty($lang)) {
$sqlEmptyLang = $persistence->quote('');
$sqlRequestedLang = $persistence->quote($lang);
$sqlLang = " AND (l_language = ${sqlEmptyLang} OR l_language = ${sqlRequestedLang})";
$sqlLang = " AND (l_language = {$sqlEmptyLang} OR l_language = {$sqlRequestedLang})";
}

$orderQueryId = $persistence->getPlatForm()->quoteIdentifier('orderq');
$orderQuerySubject = $orderQueryId . '.' . $persistence->getPlatForm()->quoteIdentifier('subject');
$orderQueryObject = $orderQueryId . '.' . $persistence->getPlatForm()->quoteIdentifier('object');

$sqlOrderFilter = "mainq.subject = ${orderQuerySubject} AND predicate = ${orderPredicate}${sqlLang}";
$sqlOrderFilter = "mainq.subject = {$orderQuerySubject} AND predicate = {$orderPredicate}{$sqlLang}";

$query = "SELECT mainq.subject, ${orderQueryObject} FROM (${query}) AS mainq LEFT JOIN ";
$query .= "statements AS ${orderQueryId} ON (${sqlOrderFilter}) ORDER BY ${orderQueryObject} ${orderDir}";
$query = "SELECT mainq.subject, {$orderQueryObject} FROM ({$query}) AS mainq LEFT JOIN ";
$query .= "statements AS {$orderQueryId} ON ({$sqlOrderFilter}) ORDER BY {$orderQueryObject} {$orderDir}";
}

// Limit...
Expand All @@ -336,7 +336,7 @@ public static function buildFilterQuery(

// Suffix order...
if (empty($order) === false) {
$query = "SELECT subject FROM (${query}) as rootq";
$query = "SELECT subject FROM ({$query}) as rootq";
}

return $query;
Expand Down
Loading