public function getAlias() { $alias = preg_replace("/[^a-zA-Z0-9]/", '-', strtolower($this->name)); if (isset($this->location)) { $address = $this->location->getAddress1(); $city = $this->location->getCity(); $state = $this->location->getState(); $zipcode = $this->location->getZipcode(); if (isset($address)) { $alias .= '-' . preg_replace("/[^a-z0-9]/", '-', strtolower($address)); } if (isset($city)) { $alias .= '-' . preg_replace("/[^a-z0-9]/", '-', strtolower($city)); } if (isset($state)) { $alias .= '-' . preg_replace("/[^a-z0-9]/", '-', strtolower($state->getName())); } if (isset($zipcode)) { $alias .= '-' . preg_replace("/[^a-z0-9]/", '-', strtolower($zipcode)); } } return $alias; }