Return ads depends on user's language
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 2 Dec 2012 04:55:53 +0000 (05:55 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 2 Dec 2012 04:55:53 +0000 (05:55 +0100)
If there are not ad with his/hes language, do not return anything.

lib/model/doctrine/AdDescriptionTable.class.php

index 42ad61e..d21111c 100644 (file)
@@ -129,19 +129,6 @@ class AdDescriptionTable extends Doctrine_Table
             {
                 $ads[] = $ad;
             }
-            else
-            {
-                //Return with the default language
-                $languageCode = sfConfig::get('app_default_language');
-                $languageId = LanguageTable::getInstance()->findOneByCode($languageCode)->getId();
-                $ad = $this->findOneByAdIdAndLanguageId($adId, $languageId);
-                //This should never happen if every ad has at least the language by default.
-                //TODO: Do not let the users create ads without the default language.
-                if ($ad != null)
-                {
-                    $ads[] = $ad;
-                }
-            }
         }
         return $ads;
     }