Пример #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;
 }
Пример #2
0
 /**
  * @test
  */
 public function removeAttributeFromObjectStorageHoldingAttributes()
 {
     $attribute = new \Aijko\SharepointConnector\Domain\Model\Mapping\Attribute();
     $localObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $localObjectStorage->attach($attribute);
     $localObjectStorage->detach($attribute);
     $this->fixture->addAttribute($attribute);
     $this->fixture->removeAttribute($attribute);
     $this->assertEquals($localObjectStorage, $this->fixture->getAttributes());
 }
 /**
  * action sync
  *
  * @param \Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list
  * @return void
  */
 public function syncAction(\Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list)
 {
     $GLOBALS['typo3CacheManager']->flushCachesByTag('spc_list_attributes');
     $sharepointAttributes = $this->sharepointListsRepository->findAttributesByListIdentifier($list->getSharepointListIdentifier());
     $typo3ListAttributes = $list->getAttributes();
     if ($sharepointAttributes) {
         // Sync sharepoint attributes with TYPO3 attributes
         $newAttributes = \Aijko\SharepointConnector\Utility\Attribute::syncAttributesAndFindAllNewOnes($sharepointAttributes, $typo3ListAttributes);
         $this->view->assign('newAttributes', $newAttributes);
         // Sync TYPO3 attributes with sharepoint attributes to find out all deprecated attributes
         $deprecatedAttributes = \Aijko\SharepointConnector\Utility\Attribute::syncAttributesToFindDeprecatedAttributes($sharepointAttributes, $typo3ListAttributes);
         if (count($deprecatedAttributes) > 0) {
             foreach ($deprecatedAttributes as $deprecatedAttribute) {
                 $this->mappingAttributeRepository->update($deprecatedAttribute);
             }
         }
         // Sync TYPO3 attributes with sharepoint attributes to find out all renamed attributes
         $renamedAttributes = \Aijko\SharepointConnector\Utility\Attribute::syncAttributesToFindRenamedAttributes($sharepointAttributes, $typo3ListAttributes, $this->mappingAttributeRepository);
         if (count($renamedAttributes) > 0) {
             foreach ($renamedAttributes as $renamedAttribute) {
                 $this->mappingAttributeRepository->update($renamedAttribute);
             }
         }
     }
     $this->view->assign('list', $list);
 }