Skip to content

Commit

Permalink
- Fixed bug #016299: reverse_related_objects and sort_by priority
Browse files Browse the repository at this point in the history
  • Loading branch information
Bertrand Dunogier committed Aug 5, 2010
1 parent aac7592 commit 73985d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Expand Up @@ -36,3 +36,4 @@ Changes from 4.4.0alpha5 to 4.4.0alpha6
- Fixed bug #017046: Inconsistent policy checks in content/trash
- Fixed bug #016247: Missing variable declaration in eznotificationtransport.php
- Fixed bug #016473: notice in ezcontentobjecttreenode / Undefined index: columns
- Fixed bug #016299: reverse_related_objects and sort_by priority
27 changes: 17 additions & 10 deletions kernel/classes/ezcontentobject.php
Expand Up @@ -518,24 +518,24 @@ function dataMap()
/**
* Generates a map with all the content object attributes where the keys are
* the attribute identifiers grouped by class attribute category.
*
*
* @note Result is not cached, so make sure you don't call this over and over.
*
* @return array
*
* @return array
*/
public function groupedDataMap()
{
return self::createGroupedDataMap( $this->fetchDataMap() );
}

/**
* Generates a map with all the content object attributes where the keys are
* the attribute identifiers grouped by class attribute category.
*
*
* @note Result is not cached, so make sure you don't call this over and over.
*
*
* @param array $contentObjectAttributes Array of eZContentObjectAttribute objects
* @return array
* @return array
*/
public static function createGroupedDataMap( $contentObjectAttributes )
{
Expand All @@ -555,7 +555,7 @@ public static function createGroupedDataMap( $contentObjectAttributes )
$groupedDataMap[ $attributeCategory ] = array();

$groupedDataMap[ $attributeCategory ][$attributeIdentifier] = $attribute;

}
return $groupedDataMap;
}
Expand Down Expand Up @@ -2897,8 +2897,15 @@ function relatedObjects( $fromObjectVersion = false,
{
if ( isset( $params['SortBy'] ) )
{
$sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( $params['SortBy'] );
$sortingString = ' ORDER BY ' . $sortingInfo['sortingFields'];
if ( !in_array( $params['SortBy'], array( 'class_identifier', 'class_name', 'modified', 'name', 'published', 'section' ) ) )
{
eZDebug::writeWarning( "Unsupported sort_by parameter {$params['SortBy']}; check the online documentation for the list of supported sort types", __METHOD__ );
}
else
{
$sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( $params['SortBy'] );
$sortingString = ' ORDER BY ' . $sortingInfo['sortingFields'];
}
}
if ( isset( $params['IgnoreVisibility'] ) )
{
Expand Down

0 comments on commit 73985d7

Please sign in to comment.