Example #1
0
 /**
  * Transforms an object to a string (id).
  *
  * @param  City|null $city
  * @return string
  */
 public function transform($city)
 {
     if (null === $city) {
         return '';
     }
     return $city->getId();
 }
Example #2
0
 /**
  * Transforms an object to a string (id).
  *
  * @param  City|null $city
  * @return string
  */
 public function transform($city)
 {
     if (null === $city) {
         return '';
     }
     $title = $city->getTitle();
     if ($region = $city->getRegion()) {
         $title .= ', ' . $region->getTitle();
     }
     if ($country = $city->getCountry()) {
         $title .= ', ' . $country->getTitle();
     }
     return $title;
 }