/** * Transforms an object to a string (id). * * @param City|null $city * @return string */ public function transform($city) { if (null === $city) { return ''; } return $city->getId(); }
/** * 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; }