Skip to content

Commit

Permalink
Change constants to strings in array keys by jeromegamez (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkamps committed Jun 8, 2020
1 parent 3749fe1 commit 85775ad
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 117 deletions.
12 changes: 6 additions & 6 deletions kernel/class/ezclassfunctioncollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ function fetchClassListByGroups( $groupFilter, $groupFilterType = 'include' )
$classNameFilter = eZContentClassName::sqlFilter( 'cc' );
$version = eZContentClass::VERSION_STATUS_DEFINED;

$sql = "SELECT DISTINCT cc.*, $classNameFilter[nameField] " .
"FROM ezcontentclass cc, ezcontentclass_classgroup ccg, $classNameFilter[from] " .
"WHERE cc.version = $version" .
$sql = "SELECT DISTINCT cc.*, {$classNameFilter['nameField']} " .
"FROM ezcontentclass cc, ezcontentclass_classgroup ccg, {$classNameFilter['from']} " .
"WHERE cc.version = {$version}" .
" AND cc.id = ccg.contentclass_id" .
" AND $groupFilter" .
" AND $classNameFilter[where] " .
"ORDER BY $classNameFilter[nameField] ASC";
" AND {$groupFilter}" .
" AND {$classNameFilter['where']} " .
"ORDER BY {$classNameFilter['nameField']} ASC";

$rows = $db->arrayQuery( $sql );
$classes = eZPersistentObject::handleRows( $rows, 'eZContentClass', true );
Expand Down
4 changes: 2 additions & 2 deletions kernel/classes/ezcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ static function clearItem( $cacheItem, $purge = false, $reporter = false, $itera
if ( is_callable( $function ) )
call_user_func_array( $function, array( $cacheItem ) );
else
eZDebug::writeError("Could not call cache item $functionName for id '$cacheItem[id]', is it a static public function?", __METHOD__ );
eZDebug::writeError("Could not call cache item {$functionName} for id '{$cacheItem['id']}', is it a static public function?", __METHOD__ );
}
else
{
if ( !isset( $cacheItem['path'] ) || strlen( $cacheItem['path'] ) < 1 )
{
eZDebug::writeError( "No path specified for cache item '$cacheItem[name]', can not clear cache.", __METHOD__ );
eZDebug::writeError( "No path specified for cache item '{$cacheItem['name']}', can not clear cache.", __METHOD__ );
return;
}

Expand Down
28 changes: 14 additions & 14 deletions kernel/classes/ezcontentclass.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ static function canInstantiateClassList( $asObject = false, $includeFilter = tru
if ( $fetchAll )
{
// If $asObject is true we fetch all fields in class
$fields = $asObject ? "cc.*, $classNameFilter[nameField]" : "cc.id, $classNameFilter[nameField]";
$rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
"FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
$fields = $asObject ? "cc.*, {$classNameFilter['nameField']}" : "cc.id, {$classNameFilter['nameField']}";
$rows = $db->arrayQuery( "SELECT DISTINCT {$fields} " .
"FROM ezcontentclass cc{$filterTableSQL}, {$classNameFilter['from']} " .
"WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " $filterSQL " .
"ORDER BY $classNameFilter[nameField] ASC" );
"ORDER BY {$classNameFilter['nameField']} ASC" );
$classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
}
else
Expand All @@ -535,12 +535,12 @@ static function canInstantiateClassList( $asObject = false, $includeFilter = tru

$classIDCondition = $db->generateSQLINStatement( $classIDArray, 'cc.id' );
// If $asObject is true we fetch all fields in class
$fields = $asObject ? "cc.*, $classNameFilter[nameField]" : "cc.id, $classNameFilter[nameField]";
$rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
"FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
$fields = $asObject ? "cc.*, {$classNameFilter['nameField']}" : "cc.id, {$classNameFilter['nameField']}";
$rows = $db->arrayQuery( "SELECT DISTINCT {$fields} " .
"FROM ezcontentclass cc{$filterTableSQL}, {$classNameFilter['from']} " .
"WHERE $classIDCondition AND" .
" cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " $filterSQL " .
"ORDER BY $classNameFilter[nameField] ASC" );
" cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " {$filterSQL} " .
"ORDER BY {$classNameFilter['nameField']} ASC" );
$classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
}

Expand Down Expand Up @@ -680,11 +680,11 @@ static function fetchAllClasses( $asObject = true, $includeFilter = true, $group
$classList = array();
$db = eZDB::instance();
// If $asObject is true we fetch all fields in class
$fields = $asObject ? "cc.*" : "cc.id, $classNameFilter[nameField]";
$rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
"FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
"WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . "$filterSQL AND $classNameFilter[where]" .
"ORDER BY $classNameFilter[nameField] ASC" );
$fields = $asObject ? "cc.*" : "cc.id, {$classNameFilter['nameField']}";
$rows = $db->arrayQuery( "SELECT DISTINCT {$fields} " .
"FROM ezcontentclass cc{$filterTableSQL}, {$classNameFilter['from']} " .
"WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . "{$filterSQL} AND {$classNameFilter['where']}" .
"ORDER BY {$classNameFilter['nameField']} ASC" );

$classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
return $classList;
Expand Down
10 changes: 5 additions & 5 deletions kernel/classes/ezcontentclassclassgroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ static function fetchClassList( $contentclass_version, $group_id, $asObject = tr
}

$db = eZDB::instance();
$sql = "SELECT contentclass.* $classNameSqlFilter[nameField]
FROM ezcontentclass contentclass, ezcontentclass_classgroup class_group $classNameSqlFilter[from]
$sql = "SELECT contentclass.* {$classNameSqlFilter['nameField']}
FROM ezcontentclass contentclass, ezcontentclass_classgroup class_group {$classNameSqlFilter['from']}
WHERE contentclass.id=class_group.contentclass_id
$versionCond
AND class_group.group_id='$group_id' $classNameSqlFilter[where]
$orderByClause";
{$versionCond}
AND class_group.group_id='$group_id' {$classNameSqlFilter['where']}
{$orderByClause}";
$rows = $db->arrayQuery( $sql );
return eZPersistentObject::handleRows( $rows, "eZContentClass", $asObject );
}
Expand Down
38 changes: 19 additions & 19 deletions kernel/classes/ezcontentobject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3281,26 +3281,26 @@ function relatedObjects( $fromObjectVersion = false,
ezcontentclass.identifier as contentclass_identifier,
ezcontentclass.is_container as is_container,
ezcontentobject.*, ezcontentobject_name.name as name, ezcontentobject_name.real_translation
$sortingInfo[attributeTargetSQL]
{$sortingInfo['attributeTargetSQL']}
FROM
ezcontentclass,
ezcontentobject,
ezcontentobject_link,
ezcontentobject_name
$sortingInfo[attributeFromSQL]
{$sortingInfo['attributeFromSQL']}
WHERE
ezcontentclass.id=ezcontentobject.contentclass_id AND
ezcontentclass.version=0 AND
ezcontentobject.status=" . eZContentObject::STATUS_PUBLISHED . " AND
$sortingInfo[attributeWhereSQL]
$relatedClassIdentifiersSQL
$relationTypeMasking
$fromOrToContentObjectID
$showInvisibleNodesCond AND
{$sortingInfo['attributeWhereSQL']}
{$relatedClassIdentifiersSQL}
{$relationTypeMasking}
{$fromOrToContentObjectID}
{$showInvisibleNodesCond} AND
ezcontentobject.id = ezcontentobject_name.contentobject_id AND
ezcontentobject.current_version = ezcontentobject_name.content_version AND
" . eZContentLanguage::sqlFilter( 'ezcontentobject_name', 'ezcontentobject' ) . "
$sortingString";
{$sortingString}";
if ( !$offset && !$limit )
{
$relatedObjects = $db->arrayQuery( $query );
Expand Down Expand Up @@ -4926,11 +4926,11 @@ function canCreateClassList( $asObject = false, $includeFilter = true, $groupLis
if ( $fetchAll )
{
// If $asObject is true we fetch all fields in class
$fields = $asObject ? "cc.*, $classNameFilter[nameField]" : "cc.id, $classNameFilter[nameField]";
$rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
"FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
"WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " $filterSQL AND $classNameFilter[where] " .
"ORDER BY $classNameFilter[nameField] ASC" );
$fields = $asObject ? "cc.*, {$classNameFilter['nameField']}" : "cc.id, {$classNameFilter['nameField']}";
$rows = $db->arrayQuery( "SELECT DISTINCT {$fields} " .
"FROM ezcontentclass cc{$filterTableSQL}, {$classNameFilter['from']} " .
"WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " {$filterSQL} AND {$classNameFilter['where']} " .
"ORDER BY {$classNameFilter['nameField']} ASC" );
$classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
}
else
Expand All @@ -4943,12 +4943,12 @@ function canCreateClassList( $asObject = false, $includeFilter = true, $groupLis

$classIDCondition = $db->generateSQLINStatement( $classIDArray, 'cc.id' );
// If $asObject is true we fetch all fields in class
$fields = $asObject ? "cc.*, $classNameFilter[nameField]" : "cc.id, $classNameFilter[nameField]";
$rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
"FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
"WHERE $classIDCondition AND" .
" cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " $filterSQL AND $classNameFilter[where] " .
"ORDER BY $classNameFilter[nameField] ASC" );
$fields = $asObject ? "cc.*, {$classNameFilter['nameField']}" : "cc.id, {$classNameFilter['nameField']}";
$rows = $db->arrayQuery( "SELECT DISTINCT {$fields} " .
"FROM ezcontentclass cc{$filterTableSQL}, {$classNameFilter['from']} " .
"WHERE {$classIDCondition} AND" .
" cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " {$filterSQL} AND {$classNameFilter['where']} " .
"ORDER BY {$classNameFilter['nameField']} ASC" );
$classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
}

Expand Down
2 changes: 1 addition & 1 deletion kernel/classes/ezcontentobjecttrashnode.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static function trashList( $params = false, $asCount = false )
ezcontentclass.identifier as class_identifier,
ezcontentobject_name.name as name,
ezcontentobject_name.real_translation
$sortingInfo[attributeTargetSQL] ";
{$sortingInfo['attributeTargetSQL']} ";
}
$query .= "FROM
ezcontentobject_trash ezcot
Expand Down
Loading

0 comments on commit 85775ad

Please sign in to comment.