]> git.mxchange.org Git - city.git/blobdiff - application/city/main/commands/html/class_HtmlCityMapCommand.php
Added verifications, if the user has already founded a city and if the city name
[city.git] / application / city / main / commands / html / class_HtmlCityMapCommand.php
index 48a048e62c28f070342090655e4af965e2435850..965accd216322b3a476e6945f1fd1ad7e5f5ee8d 100644 (file)
@@ -58,17 +58,20 @@ class HtmlCityMapCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // First get a UserRegistration instance
-               $managerInstance = ObjectFactory::createObjectByConfiguredName('city_manager_class');
+               $managerInstance = ManagerFactory::createManagerByType('city');
 
                // First set request and response instance
                $managerInstance->setRequestInstance($requestInstance);
                $managerInstance->setResponseInstance($responseInstance);
 
-               // Do things before adding city
-               $managerInstance->doPreAddCity();
-
-               // Add new city
-               $managerInstance->addNewCity();
+               // Is there already a city the user has founded?
+               if ($managerInstance->isCityAlreadyFounded()) {
+                       // Found 2nd,3rd,... city
+                       $managerInstance->foundNewCity();
+               } else {
+                       // Found first city
+                       $managerInstance->foundFirstCity();
+               }
 
                // Redirect or login after registration
                $managerInstance->doPostAction();
@@ -89,6 +92,9 @@ class HtmlCityMapCommand extends BaseCommand implements Commandable {
                // Validate user status ('confirmed' no guest)
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
 
+               // Check if city name is already used
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_name_verifier_filter'));
+
                // Validate ...
                //$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter'));
        }