Esempio n. 1
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 update
  *
  * @param \Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list
  * @param array $attributeData
  * @dontvalidate $mappingLists
  * @dontvalidate $attributeData
  * @return void
  */
 public function updateAction(\Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list, array $attributeData)
 {
     $attributesArray = array();
     if (count($attributeData['available']) > 0) {
         foreach ($attributeData['available'] as $key => $attributes) {
             $attributesArray[] = $attributes;
             $mappingAttribute = $this->propertyMapper->convert($attributes, 'Aijko\\SharepointConnector\\Domain\\Model\\Mapping\\Attribute');
             $this->mappingAttributeRepository->update($mappingAttribute);
         }
     }
     if (count($attributeData['new']) > 0) {
         foreach ($attributeData['new'] as $key => $attributes) {
             if (!$attributes['activated']) {
                 continue;
             }
             unset($attributes['activated']);
             $attributesArray[] = $attributes;
             $mappingAttribute = $this->propertyMapper->convert($attributes, 'Aijko\\SharepointConnector\\Domain\\Model\\Mapping\\Attribute');
             $list->addAttribute($mappingAttribute);
         }
     }
     $this->mappingListsRepository->update($list);
     $this->flashMessageContainer->add('ListMapping "' . $list->getSharepointListTitle() . '" was updated.');
     Logger::info('MappingController:updateAction', array('listMappingUid' => $list->getUid(), 'sharepointListIdentifier' => $list->getSharepointListIdentifier(), 'typo3ListTitle' => $list->getTypo3ListTitle(), 'attributes' => json_encode($attributesArray)));
     $this->redirect('edit', NULL, NULL, array('list' => $list));
 }