public function testGetFieldTypeIdentifier() { $fieldTypeIdentifier = 'ezstring'; $fieldDefinition = $this->getMockBuilder('\\eZ\\Publish\\API\\Repository\\Values\\ContentType\\FieldDefinition')->setConstructorArgs([['fieldTypeIdentifier' => $fieldTypeIdentifier]])->getMockForAbstractClass(); $data = new FieldDefinitionData(['fieldDefinition' => $fieldDefinition]); self::assertSame($fieldTypeIdentifier, $data->getFieldTypeIdentifier()); }
public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data) { $fieldTypeIdentifier = $data->getFieldTypeIdentifier(); if (!$this->hasMapper($fieldTypeIdentifier)) { return; } $this->fieldTypeFormMappers[$fieldTypeIdentifier]->mapFieldDefinitionForm($fieldDefinitionForm, $data); }
/** * Checks if the passed value is valid. * * @param FieldDefinitionData $value The value that should be validated * @param Constraint $constraint The constraint for the validation * * @api */ public function validate($value, Constraint $constraint) { if (!$value instanceof FieldDefinitionData) { return; } $fieldType = $this->fieldTypeService->getFieldType($value->getFieldTypeIdentifier()); $this->processValidationErrors($fieldType->validateValidatorConfiguration($value->validatorConfiguration)); }