Ejemplo n.º 1
0
 /**
  * @test
  */
 public function setNameForStringSetsName()
 {
     $this->subject->setName('Conceived at T3CON10');
     $this->assertAttributeEquals('Conceived at T3CON10', 'name', $this->subject);
 }
 /**
  * action update
  * @param \MUM\BjrFreizeit\Domain\Model\Country $country
  * @return void
  *
  */
 public function updateAction(\MUM\BjrFreizeit\Domain\Model\Country $country)
 {
     $redirectParams = array();
     $args = $this->request->getArguments();
     $referrer = $args['referer'];
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($referrer, 'Referrer');
     $GLOBALS['TSFE']->fe_user->setKey("ses", "referrer", $referrer);
     if ($country->_isNew() || $country->_isDirty()) {
         if ($country->_isNew()) {
             if ($this->validateCountry($args)) {
                 $country->setPid($this->settings['pidOrganizationFolder']);
                 $this->countryRepository->add($country);
                 //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", "countryChange", 'Das Land <strong>' . $country->getName() . '</strong> wurde neu angelegt.');
             } else {
                 $errors = $this->getValidationErrors();
                 //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($errors, 'Errors');
                 //exit;
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "editErrors", implode('. ', $errors));
                 $redirectParams['country'] = null;
                 $this->redirect('new', 'Country', NULL, $redirectParams);
             }
         } else {
             $this->countryRepository->update($country);
             $GLOBALS['TSFE']->fe_user->setKey("ses", "countryChange", 'Die Ferienzeit <strong>' . $country->getName() . '</strong> wurde geändert.');
         }
     }
     $redirectParams['country'] = $country;
     $this->redirect('successUpdate', 'Country', NULL, $redirectParams);
 }