Вопрос

I wanted to select cities depending from countries so i made this code, but the funny things here is that code show me only the id of the countries that's it and he ignores totally the cities query, it doesn't return nothing:

public function ctsAction() {


                $ctry = $this->get('doctrine_mongodb')
                       ->getRepository('indexBundle:Ctes')
                       ->findOneByCountryName($q_country);

                if( !empty($ctry) ) 
                {
                    $search_country = $ctry->getCtryId();

                    $cties_list = $this->get('doctrine_mongodb')
                                   ->getRepository('indexBundle:Cties')
                                   ->findOneByCountryId($ctry);
                }



    }

If u need some other things tell me, from where comes the problem?

Это было полезно?

Решение

I solved like that:

$result =  array();
$return = array();
$result = $cties_list->toArray();
foreach ($result as $val) {
  array_push($return, $val->getCityName());
};

If there is any other suggestion, don't hesitate

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top