/**
  * action update
  * @param \MUM\BjrFreizeit\Domain\Model\Organization $organization
  * @return void
  *
  * @ignorevalidate   \MUM\BjrFreizeit\Validation\Validator\Organization
  */
 public function updateAction(\MUM\BjrFreizeit\Domain\Model\Organization $organization)
 {
     $redirectParams = array();
     //array('passwordChange' => '',    'organization' => $organization,'organizationChange' => ''       );
     $args = $this->request->getArguments();
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($args);
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($organization);
     if (array_key_exists('organizationUpdate', $args)) {
         if (strlen($args['password']) > 0) {
             $passwordChange = $this->doPasswordChange(array($this->request->getArgument('password'), $this->request->getArgument('passwordConfirmation')), $this->request->getArgument('feuserId'));
             if ($passwordChange == 1) {
                 $this->setFlashMessage('Das Passwort wurde geändert.');
                 //$redirectParams['passwordChange'] = 'Das Passwort wurde geändert.';
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "passwordChange", 'Das Passwort wurde geändert.');
             }
             if ($passwordChange == -1) {
                 $this->setFlashMessage('Das Passwort stimmt nicht mit der Kontrolleingabe überein.', 'FEHLER', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                 $this->forward('edit');
             }
         }
         //select Field value is not set in organization, do it manually
         if ($this->isAdministratorMode()) {
             $organization->setLeisureFolderPid($this->request->getArgument('leisureFolderPid'));
         }
         if ($this->request->hasArgument('creation') && $this->request->getArgument('creation') == 1) {
             $organization->setPid($this->settings['pidOrganizationFolder']);
             $organization->setFeusername($this->frontendUserRepository->findByUid($this->request->getArgument('username')));
             //email Adresse ist pflicht
             if ($this->validateOrganization($args)) {
                 $this->organizationRepository->add($organization);
                 //it is not persistent already, we have to do it!
                 $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
                 $persistenceManager->persistAll();
                 //now organization ist persistent
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "organizationChange", 'Die Ausleihstelle wurde neu angelegt.');
             } else {
                 $errors = $this->getValidationErrors();
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "editErrors", implode('.<br />', $errors));
                 //DebuggerUtility::var_dump($organization);
                 //exit();
                 //$redirectParams['organization'] = $organization;
                 $redirectParams['attributes'] = $args;
                 $this->redirect('new', 'Organization', NULL, $redirectParams);
             }
         } else {
             if ($this->validateOrganization($args)) {
                 $this->organizationRepository->update($organization);
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "organizationChange", 'Die Ausleihstelle wurde geändert.');
             } else {
                 $errors = $this->getValidationErrors();
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "editErrors", implode('. ', $errors));
                 $redirectParams['organization'] = $organization;
                 $this->redirect('edit', 'Organization', NULL, $redirectParams);
             }
         }
     }
     $redirectParams['organization'] = $organization;
     $this->redirect('successUpdate', 'Organization', NULL, $redirectParams);
 }
 /**
  * @param \MUM\BjrFreizeit\Domain\Model\Organization
  * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  * find all articles for pid which belongs to organization
  */
 public function findByOrganization(\MUM\BjrFreizeit\Domain\Model\Organization $organization)
 {
     $pid = $organization->getLeisureFolderPid();
     $querySettings = $this->createQuery()->getQuerySettings();
     $querySettings->setStoragePageIds(array($pid));
     $this->setDefaultQuerySettings($querySettings);
     return $this->findByPid($pid);
 }
 /**
  * @test
  */
 public function setContactForContactSetsContact()
 {
     $contactFixture = new \MUM\BjrFreizeit\Domain\Model\Contact();
     $this->subject->setContact($contactFixture);
     $this->assertAttributeEquals($contactFixture, 'contact', $this->subject);
 }