Create a stdClass object with filter data.

@param $reportDefinitionFields
@return \stdClass
494455
private function createObj($reportDefinitionFields)
    {
        $obj = new \stdClass();

        foreach ($reportDefinitionFields as $reportDefinitionField) {
            $name = $reportDefinitionField->getFieldName();
            $obj->$name = [
                'type' => $reportDefinitionField->getFieldType(),
                'values' => ($reportDefinitionField->getEnumValues() !== null) ? $reportDefinitionField->getEnumValues() : null,
            ];

        }

        return $obj;
    }
422507
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value',
                reset($field->value->data),
                new Search\FieldType\StringField()
            ),
        );
    }
1249572
private function buildField(CriterionDefinition $definition)
    {
        return new Field(
            $definition->target,
            $definition->operator,
            $definition->value
        );
    }
213677
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value',
                $field->value->data,
                new Search\FieldType\FloatField()
            ),
            new Search\Field(
                'fulltext',
                $field->value->data,
                new Search\FieldType\FullTextField()
            ),
        );
    }
184080
public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
    {
        $storageDef->dataInt3 = (int)$fieldDef->defaultValue->data;
    }
332527
public function setFieldDefinitions(array $fieldDefinitionObjects)
    {
        $this->data['fields'] = [];
        foreach ($fieldDefinitionObjects as $identifier => $fieldDefinitionObject) {
            $this->addFieldDefinitionObject($identifier, $fieldDefinitionObject);
        }
    }
760977
public function toFieldDefinition(StorageFieldDefinition $storageDefinition, FieldDefinition $fieldDefinition)
    {
        $fieldDefinition->fieldTypeConstraints->fieldSettings = new FieldSettings(
            [
                'numRows' => $storageDefinition->dataInt1,
                'tagPreset' => $storageDefinition->dataText2 ? (int)$storageDefinition->dataText2 : Type::TAG_PRESET_DEFAULT,
            ]
        );

        $defaultValue = null;
        if (!empty($storageDefinition->dataText1)) {
            $defaultValue = $storageDefinition->dataText1;
        }

        $fieldDefinition->defaultValue->data = $defaultValue;
    }
506582
private function processSimpleField($name, Schema\Field $definition)
    {
        if (strpos($definition->getType(), 'class:') === 0) {
            $field = new JsonDefinitionRel($name, $definition, $this->getRelation($name));
        } else {
            $field = new JsonDefinitionField($name, $definition);
        }

        if (substr($definition->getType(), -2) === '[]') {
            $field = new JsonDefinitionArray($name, $field);
        }

        return $field;
    }
683388
public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
    {
        $options = [];
        $multiLingualOptions = [$fieldDef->mainLanguageCode => []];

        if (isset($storageDef->dataText5)) {
            $optionsXml = simplexml_load_string($storageDef->dataText5);
            if ($optionsXml !== false) {
                foreach ($optionsXml->options->option as $option) {
                    $options[(int)$option['id']] = (string)$option['name'];
                }
            }
        }

        if (isset($fieldDef->mainLanguageCode) && !empty($options)) {
            $multiLingualOptions[$fieldDef->mainLanguageCode] = $options;
        }

        foreach ($storageDef->multilingualData as $languageCode => $mlData) {
            $xml = simplexml_load_string($mlData->dataText);
            if ($xml !== false) {
                foreach ($xml->options->option as $option) {
                    $multiLingualOptions[$languageCode][(int)$option['id']] = (string)$option['name'];
                }
            }
        }

        $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings([
                'isMultiple' => !empty($storageDef->dataInt1) ? (bool)$storageDef->dataInt1 : false,
                'options' => $options,
                'multilingualOptions' => $multiLingualOptions,
            ]
        );

        // @todo: Can Selection store a default value in the DB?
        $fieldDef->defaultValue = new FieldValue();
        $fieldDef->defaultValue->data = array();
        $fieldDef->defaultValue->sortKey = '';
    }
913868
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value',
                $field->value->data['destinationContentIds'],
                new Search\FieldType\MultipleStringField()
            ),
            new Search\Field(
                'sort_value',
                implode('-', $field->value->data['destinationContentIds']),
                new Search\FieldType\StringField()
            ),
        );
    }
16000
public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
    {
        $useSeconds = (bool)$storageDef->dataInt2;
        $dateInterval = $this->getDateIntervalFromXML($storageDef->dataText5);

        $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings(
            array(
                'defaultType' => $storageDef->dataInt1,
                'useSeconds' => $useSeconds,
                'dateInterval' => $dateInterval,
            )
        );

        // Building default value
        switch ($fieldDef->fieldTypeConstraints->fieldSettings['defaultType']) {
            case DateAndTimeType::DEFAULT_CURRENT_DATE:
                $data = array(
                    'rfc850' => null,
                    'timestamp' => time(), // @deprecated timestamp is no longer used and will be removed in a future version.
                    'timestring' => 'now',
                );
                break;

            case DateAndTimeType::DEFAULT_CURRENT_DATE_ADJUSTED:
                if (!$useSeconds) {
                    $dateInterval->s = 0;
                }
                $date = new DateTime();
                $date->add($dateInterval);
                $data = array(
                    'rfc850' => null,
                    'timestamp' => $date->getTimestamp(), // @deprecated timestamp is no longer used and will be removed in a future version.
                    'timestring' => $dateInterval->format('%y years, %m months, %d days, %h hours, %i minutes, %s seconds'),
                );
                break;

            default:
                $data = null;
        }

        $fieldDef->defaultValue->data = $data;
    }
1096622
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new ReportCollector();

        /** @var Service\Report $reportService */
        $reportService = $serviceLocator->get('KmbPuppetDb\Service\Report');
        $service->setReportService($reportService);

        /** @var QueryBuilderInterface $reportsEnvironmentsQueryBuilder */
        $reportsEnvironmentsQueryBuilder = $serviceLocator->get('KmbPuppetDb\Query\ReportsEnvironmentsQueryBuilder');
        $service->setReportsEnvironmentsQueryBuilder($reportsEnvironmentsQueryBuilder);

        /** @var EnvironmentInterface $permissionEnvironmentService */
        $permissionEnvironmentService = $serviceLocator->get('KmbPermission\Service\Environment');
        $service->setPermissionEnvironmentService($permissionEnvironmentService);

        return $service;
    }
1296236
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        return array(
            new Search\Field(
                'value',
                // @todo: Data is yet empty, this seems wrong, so we use the
                // sort field for now
                $field->value->sortKey['sort_key_int'] / 1000,
                new Search\FieldType\PriceField()
            ),
            new Search\Field(
                'fulltext',
                $field->value->sortKey['sort_key_int'] / 1000,
                new Search\FieldType\FullTextField()
            ),
        );
    }
700268
public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
    {
        $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings(
            array(
                'defaultType' => $storageDef->dataInt1,
                'useSeconds' => (bool)$storageDef->dataInt2,
            )
        );

        // Building default value
        switch ($fieldDef->fieldTypeConstraints->fieldSettings['defaultType']) {
            case TimeType::DEFAULT_CURRENT_TIME:
                $dateTime = new DateTime();
                $data = $dateTime->getTimestamp() - $dateTime->setTime(0, 0, 0)->getTimestamp();
                break;
            default:
                $data = null;
        }

        $fieldDef->defaultValue->data = $data;
    }
732790
public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
    {
        if (isset($fieldDef->fieldTypeConstraints->fieldSettings['isISBN13'])) {
            $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->fieldSettings['isISBN13'];
        } else {
            $storageDef->dataInt1 = 1;
        }

        $storageDef->dataText1 = $fieldDef->defaultValue->data;
    }
722506
public function build()
    {
        $prevState = libxml_use_internal_errors(true);

        try {
            $doc = $this->buildDocument();

            if (!empty($this->schema) && !$doc->schemaValidate($this->schema)) {
                throw ReportDefinitionException::schemaValidation(libxml_get_errors());
            }

            if (false === $xml = $doc->saveXML()) {
                throw ReportDefinitionException::compileError(libxml_get_errors());
            }

            return $xml;
        } finally {
            libxml_clear_errors();
            libxml_use_internal_errors($prevState);
        }
    }
283030
public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
    {
        $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings(
            array(
                'textRows' => $storageDef->dataInt1,
            )
        );
        $fieldDef->defaultValue->data = null;
        $fieldDef->defaultValue->sortKey = '';
    }