문제

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