From 4ed347babf77672e9239420bab77630a317a2c3d Mon Sep 17 00:00:00 2001 From: Yannick ROGER Date: Fri, 30 May 2014 14:51:21 +0200 Subject: [PATCH] Fix EZP-22859: Object Relations versions not saved correctly in Solr --- classes/ezfsolrdocumentfieldobjectrelation.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/ezfsolrdocumentfieldobjectrelation.php b/classes/ezfsolrdocumentfieldobjectrelation.php index 50ce005f..23a39b6e 100644 --- a/classes/ezfsolrdocumentfieldobjectrelation.php +++ b/classes/ezfsolrdocumentfieldobjectrelation.php @@ -297,12 +297,15 @@ public function getData() $subObjectID = $relationItem['contentobject_id']; if ( !$subObjectID ) continue; - $subObject = eZContentObjectVersion::fetchVersion( $relationItem['contentobject_version'], $subObjectID ); + + // Using last version of object (version inside xml data is the original version) + $subObject = eZContentObject::fetch( $subObjectID ); + if ( !$subObject || $relationItem['in_trash'] ) continue; // 1st create aggregated metadata fields - $metaAttributeValues = eZSolr::getMetaAttributesForObject( $subObject->attribute( 'contentobject' ) ); + $metaAttributeValues = eZSolr::getMetaAttributesForObject( $subObject ); foreach ( $metaAttributeValues as $metaInfo ) { $submetaFieldName = ezfSolrDocumentFieldBase::generateSubmetaFieldName( $metaInfo['name'], $contentClassAttribute );