/** * @param $data * @param Tx_PtExtlist_Domain_Configuration_Columns_ObjectMapper_ObjectMapperConfig $configuration * @return object */ public function convert($data, $configuration) { if ($configuration->getMapping()) { $this->applyKeyMapping($configuration->getMapping(), $data); } $mappedObject = $this->mapper->map(array(), $data, $configuration->getClass()); if ($mappedObject === NULL) { throw new Exception('The data could mot be mapped to the object of class' . $configuration->getClass() . '. Reason: ' . implode(', ', $this->mapper->getMappingResults()->getErrors())); } return $mappedObject; }
/** * @test */ public function getClassReturnsClassIfDefined() { $objectMapperConfig = new Tx_PtExtlist_Domain_Configuration_Columns_ObjectMapper_ObjectMapperConfig($this->configurationBuilderMock, array('class' => 'Tx_PtExtlist_Tests_Domain_Configuration_Columns_ObjectMapper_ObjectMapperConfigTest')); $this->assertEquals('Tx_PtExtlist_Tests_Domain_Configuration_Columns_ObjectMapper_ObjectMapperConfigTest', $objectMapperConfig->getClass()); }