Exemplo n.º 1
0
 /**
  * @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 mappingIsRetutrnedAsArray()
 {
     $mapping = array('x' => 'y', 'z' => 'a');
     $objectMapperConfig = new Tx_PtExtlist_Domain_Configuration_Columns_ObjectMapper_ObjectMapperConfig($this->configurationBuilderMock, array('class' => 'Tx_PtExtlist_Tests_Domain_Configuration_Columns_ObjectMapper_ObjectMapperConfigTest', 'mapping' => $mapping));
     $this->assertEquals($mapping, $objectMapperConfig->getMapping());
 }