@@ 1154-1172 (lines=19) @@ | ||
1151 | * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion |
|
1152 | * @param string $fieldName |
|
1153 | */ |
|
1154 | protected function modifyFieldCriterion(Criterion $criterion, $fieldName) |
|
1155 | { |
|
1156 | $setupFactory = $this->getSetupFactory(); |
|
1157 | /** @var \Symfony\Component\DependencyInjection\ContainerBuilder $container */ |
|
1158 | $container = $setupFactory->getServiceContainer()->getInnerContainer(); |
|
1159 | ||
1160 | /** @var \eZ\Publish\Core\Search\Common\FieldNameResolver $fieldNameResolver */ |
|
1161 | $fieldNameResolver = $container->get('ezpublish.search.common.field_name_resolver'); |
|
1162 | $resolvedFieldNames = $fieldNameResolver->getFieldNames( |
|
1163 | $criterion, |
|
1164 | 'data', |
|
1165 | $this->getTypeName(), |
|
1166 | $fieldName |
|
1167 | ); |
|
1168 | $resolvedFieldName = reset($resolvedFieldNames); |
|
1169 | $criterion = [$criterion]; |
|
1170 | ||
1171 | $this->doModifyField($criterion, $resolvedFieldName); |
|
1172 | } |
|
1173 | ||
1174 | /** |
|
1175 | * Sets given custom field $fieldName on a Field sort clause. |
|
@@ 1183-1200 (lines=18) @@ | ||
1180 | * @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause |
|
1181 | * @param string $fieldName |
|
1182 | */ |
|
1183 | protected function modifyFieldSortClause(SortClause $sortClause, $fieldName) |
|
1184 | { |
|
1185 | $setupFactory = $this->getSetupFactory(); |
|
1186 | /** @var \Symfony\Component\DependencyInjection\ContainerBuilder $container */ |
|
1187 | $container = $setupFactory->getServiceContainer()->getInnerContainer(); |
|
1188 | ||
1189 | /** @var \eZ\Publish\Core\Search\Common\FieldNameResolver $fieldNameResolver */ |
|
1190 | $fieldNameResolver = $container->get('ezpublish.search.common.field_name_resolver'); |
|
1191 | $resolvedFieldName = $fieldNameResolver->getSortFieldName( |
|
1192 | $sortClause, |
|
1193 | 'test-' . $this->getTypeName(), |
|
1194 | 'data', |
|
1195 | $fieldName |
|
1196 | ); |
|
1197 | $sortClause = [$sortClause]; |
|
1198 | ||
1199 | $this->doModifyField($sortClause, $resolvedFieldName); |
|
1200 | } |
|
1201 | ||
1202 | /** |
|
1203 | * Sets given custom field $fieldName on a Field criteria or sort clauses. |