コード例 #1
0
ファイル: EventEditor.php プロジェクト: kurtkk/seminars
 /**
  * Sets the data of a place model based on the data given in $formData.
  *
  * @param tx_seminars_Model_Place $place the place model to set the data
  * @param string $prefix the prefix of the form fields in $formData
  * @param array[] $formData the form data to use for setting the place data
  *
  * @return void
  */
 private static function setPlaceData(tx_seminars_Model_Place $place, $prefix, array $formData)
 {
     $countryUid = (int) $formData[$prefix . 'country'];
     if ($countryUid > 0) {
         try {
             /** @var tx_oelib_Mapper_Country $mapper */
             $mapper = Tx_Oelib_MapperRegistry::get('tx_oelib_Mapper_Country');
             /** @var Tx_Oelib_Model_Country $country */
             $country = $mapper->find($countryUid);
         } catch (Exception $exception) {
             $country = NULL;
         }
     } else {
         $country = NULL;
     }
     $place->setTitle(trim(strip_tags($formData[$prefix . 'title'])));
     $place->setAddress(trim(strip_tags($formData[$prefix . 'address'])));
     $place->setZip(trim(strip_tags($formData[$prefix . 'zip'])));
     $place->setCity(trim(strip_tags($formData[$prefix . 'city'])));
     $place->setCountry($country);
     $place->setHomepage(trim(strip_tags($formData[$prefix . 'homepage'])));
     $place->setDirections(trim($formData[$prefix . 'directions']));
     $place->setNotes(trim(strip_tags($formData[$prefix . 'notes'])));
 }
コード例 #2
0
ファイル: PlaceTest.php プロジェクト: kurtkk/seminars
 /**
  * @test
  */
 public function setZipSetsZip()
 {
     $this->fixture->setZip('13373');
     self::assertEquals('13373', $this->fixture->getZip());
 }