Ejemplo n.º 1
0
 /**
  * Convert users post-data-array to correct sharepoint data array
  *
  * @param \Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list
  * @param array $data
  * @return array
  * @throws \Aijko\SharepointConnector\Utility\Exception
  */
 public static function convertToSharepointData(\Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list, array $data)
 {
     $returnData = array();
     foreach ($list->getAttributes() as $key => $attribute) {
         if (!array_key_exists($attribute->getTypo3FieldName(), $data)) {
             continue;
         }
         $returnData[$attribute->getSharepointFieldName()] = $data[$attribute->getTypo3FieldName()];
     }
     if (!count($returnData)) {
         throw new \Aijko\SharepointConnector\Utility\Exception('Could not map user data with mapping (list: ' . $list->getTypo3ListTitle() . ':Uid:' . $list->getUid() . '). Cant find matched attributes.', 1391164526);
     }
     return $returnData;
 }
 /**
  * Delete single attribute
  *
  * @param \Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list
  * @param \Aijko\SharepointConnector\Domain\Model\Mapping\Attribute $mappingAttribute
  * @return void
  */
 public function deleteAttributeAction(\Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list, \Aijko\SharepointConnector\Domain\Model\Mapping\Attribute $mappingAttribute)
 {
     $this->mappingAttributeRepository->remove($mappingAttribute);
     $this->flashMessageContainer->add('Your attribute "' . $mappingAttribute->getTypo3FieldName() . '" was deleted.');
     Logger::info('MappingController:deleteAttributeAction', array('listMappingUid' => $list->getUid(), 'sharepointListIdentifier' => $list->getSharepointListIdentifier(), 'typo3ListTitle' => $list->getTypo3ListTitle(), 'attributeUid' => $list->getUid(), 'attribute' => $mappingAttribute->getTypo3FieldName()));
     $this->redirect('edit', NULL, NULL, array('list' => $list));
 }