Exemplo n.º 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();
 }
Exemplo n.º 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 ($country = $city->getCountry()) {
         $title .= ', ' . $country->getTitle();
     }
     return $title;
 }