Hi,

sry, but i dont want to use google code. I need to build my own 
opengeodb-plugin for this app.
All vars are filled and cake displays no errors and no log-messages.
debug($this->Zipcode->listZipcodesNearBy("19370")); has no output.
Cake dumps only first query ($this->findByZipcode) but not second.
I dont know how to solve this.
Is there a way to get the statement how cake build it? Maybe this way i can 
find any errors.

Am Freitag, 7. Dezember 2012 15:27:16 UTC+1 schrieb euromark:
>
> no errors? just an empty resultset?
> what is the query you result in?
>
> Until very recently I got a bug in my distance query, as well. Maybe thats 
> what happens here?
> might be just some () missing or $lng instead of $lng somewhere
>
> To confirm that you could try using my (now correctly working) behavior to 
> compare it:
> http://www.dereuromark.de/2012/06/12/geocoding-with-cakephp/
>
> $this->setDistanceAsVirtualField($lat, $lng);
>
> and see if it returns sth now.
>
>
>
> Am Freitag, 7. Dezember 2012 15:21:31 UTC+1 schrieb Mathias R:
>>
>> Hi,
>>
>> i have a Modelaction where i want to list all zipcodes within a radius 
>> nearby another zipcode
>>
>>     public function listZipcodesNearBy($zipcode = '', $radius = false, 
>> $km = 1.609344) {
>>         if ($data = $this->findByZipcode($zipcode)) {
>>             $lat = $data['Zipcode']['cityLat'];
>>             $lng = $data['Zipcode']['cityLng'];
>>             
>>             $this->virtualFields['distance'] = '
>>                 ACOS (
>>                     SIN('.$lat.' * PI() / 180) *
>>                     SIN(cityLat * PI() / 180) +
>>                     COS('.$lat.' * PI() / 180) *
>>                     COS(cityLat * PI() / 180) *
>>                     COS(('.$lng.' - cityLng) * PI() / 180)
>>                 ) * 180 / PI() * 60 * 1.1515 * '.$km;
>>             
>>             $conditions = array();
>>             if (isset($radius)) {
>>                 $conditions = array("distance <=", (int)$radius);
>>             }
>>             return $this->find('list', compact('conditions'));
>>
>>         }
>>         return false;
>>     }
>>
>> When i don't use virtualfields and comment out $conditions with distance 
>> <= $radius i get a list of zipcodes. But with virtualfields there's no 
>> output. no errors too..
>>
>> Do you see the error? Is there a way to print sql statements build in 
>> models without action?
>>
>> Please help.
>>
>> Greetings from Germany
>> M.
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to