コード例 #1
0
 /**
  * Get sort field name
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
  * @param string $contentTypeIdentifier
  * @param string $fieldDefinitionIdentifier
  * @param string $name
  *
  * @return array
  */
 protected function getSortFieldName(
     SortClause $sortClause,
     $contentTypeIdentifier,
     $fieldDefinitionIdentifier,
     $name = null
 )
 {
     return $this->fieldNameResolver->getSortFieldName(
         $sortClause,
         $contentTypeIdentifier,
         $fieldDefinitionIdentifier,
         $name
     );
 }
コード例 #2
0
ファイル: Tags.php プロジェクト: netgen/tagsbundle
 /**
  * Resolves the targeted fields for this criterion.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  *
  * @return array
  */
 protected function getTargetFieldNames(Criterion $criterion)
 {
     if ($criterion->target != null) {
         return $this->fieldNameResolver->getFieldNames($criterion, $criterion->target, $this->fieldTypeIdentifier, $this->fieldName);
     }
     $targetFieldNames = array();
     foreach ($this->contentTypeHandler->getSearchableFieldMap() as $fieldDefinitions) {
         foreach ($fieldDefinitions as $fieldIdentifier => $fieldDefinition) {
             if (!isset($fieldDefinition['field_type_identifier'])) {
                 continue;
             }
             if ($fieldDefinition['field_type_identifier'] != $this->fieldTypeIdentifier) {
                 continue;
             }
             $solrFieldNames = $this->fieldNameResolver->getFieldNames($criterion, $fieldIdentifier, $this->fieldTypeIdentifier, $this->fieldName);
             $targetFieldNames = array_merge($targetFieldNames, $solrFieldNames);
         }
     }
     return array_values(array_unique($targetFieldNames));
 }
コード例 #3
0
ファイル: Field.php プロジェクト: nlescure/ezpublish-kernel
 /**
  * Get field names
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param string $fieldDefinitionIdentifier
  * @param string $fieldTypeIdentifier
  * @param string $name
  *
  * @return array
  */
 protected function getFieldNames(Criterion $criterion, $fieldDefinitionIdentifier, $fieldTypeIdentifier = null, $name = null)
 {
     return $this->fieldNameResolver->getFieldNames($criterion, $fieldDefinitionIdentifier, $fieldTypeIdentifier, $name);
 }
コード例 #4
0
ファイル: TagKeywordTest.php プロジェクト: netgen/tagsbundle
 /**
  * @covers \Netgen\TagsBundle\Core\Search\Solr\Query\Content\CriterionVisitor\Tags\TagKeyword::visit
  * @covers \Netgen\TagsBundle\Core\Search\Solr\Query\Content\CriterionVisitor\Tags::getTargetFieldNames
  * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
  */
 public function testVisitThrowsInvalidArgumentException()
 {
     $criterion = new Criterion\TagKeyword(Operator::IN, array('tag1', 'tag2'), 'tags_field');
     $this->fieldNameResolver->expects($this->once())->method('getFieldNames')->with($this->equalTo($criterion), $this->equalTo('tags_field'), 'eztags', 'tag_keywords')->will($this->returnValue(array()));
     $this->visitor->visit($criterion);
 }
コード例 #5
0
 /**
  * Get field type information
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param string $fieldDefinitionIdentifier
  *
  * @return array
  */
 protected function getFieldNames(Criterion $criterion, $fieldDefinitionIdentifier)
 {
     return $this->fieldNameResolver->getFieldNames($criterion, $fieldDefinitionIdentifier);
 }
コード例 #6
0
 /**
  * Get array of search fields.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  *
  * @return \eZ\Publish\SPI\Search\FieldType[] Array of field types indexed by name.
  */
 protected function getSearchFields(Criterion $criterion)
 {
     return $this->fieldNameResolver->getFieldTypes($criterion, $criterion->target);
 }