public static mappingNotFound ( string $className, string $fieldName ) : |
||
$className | string | |
$fieldName | string | |
return |
function it_checks_a_non_existent_mapping_relationship($classMetadata, ConfigurationInterface $configuration) { $configuration->getType()->willReturn(ConfigurationInterface::TYPE_MULTI); $configuration->getName()->willReturn('foo'); $classMetadata->getFieldMapping('foo')->willThrow(MappingException::mappingNotFound('spec\\Pim\\Bundle\\ReferenceDataBundle\\RequirementChecker\\CustomValidProductValue', 'foo')); $this->check($configuration)->shouldReturn(false); $this->getFailure()->shouldReturn("No mapping found for field 'foo' in class " . "'spec\\Pim\\Bundle\\ReferenceDataBundle\\RequirementChecker\\CustomValidProductValue'."); }
/** * Gets the mapping of a field. * * @param string $fieldName The field name. * * @return array The field mapping. * * @throws MappingException if the $fieldName is not found in the fieldMappings array * * @throws MappingException */ public function getFieldMapping($fieldName) { if (!isset($this->fieldMappings[$fieldName])) { throw MappingException::mappingNotFound($this->name, $fieldName); } return $this->fieldMappings[$fieldName]; }