/** * Returns field definition for the given field definition id * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If field definition is not found * * @param mixed $id * @param int $status One of Type::STATUS_DEFINED|Type::STATUS_DRAFT|Type::STATUS_MODIFIED * * @return \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition */ public function getFieldDefinition($id, $status) { if (isset($this->fieldDefinitions[$id][$status])) { return $this->fieldDefinitions[$id][$status]; } return $this->fieldDefinitions[$id][$status] = $this->innerHandler->getFieldDefinition($id, $status); }
/** * Returns an array of FullTextValue object containing searchable values of content object * fields for the given $content. * * @param \eZ\Publish\SPI\Persistence\Content $content * * @return \eZ\Publish\Core\Search\Legacy\Content\FullTextValue[] */ protected function getFullTextValues(Content $content) { $fullTextValues = []; foreach ($content->fields as $field) { $fieldDefinition = $this->contentTypeHandler->getFieldDefinition($field->fieldDefinitionId, Content\Type::STATUS_DEFINED); if (!$fieldDefinition->isSearchable) { continue; } $value = $this->getFullTextFieldValue($field, $fieldDefinition); if (empty($value)) { continue; } $fullTextValues[] = new FullTextValue(['id' => $field->id, 'fieldDefinitionId' => $field->fieldDefinitionId, 'fieldDefinitionIdentifier' => $fieldDefinition->identifier, 'languageCode' => $field->languageCode, 'value' => !is_array($value) ? $value : implode(' ', $value)]); } return $fullTextValues; }