doctrine

Error in Geographical Template - input is out of range - Doctrine / Symfony

If you are using the getDistance method provided by Geogrphical Template in Doctrine and got this error:

UPDATE: IT WAS FIXED, CHECK IT OUT AT http://www.doctrine-project.org/jira/browse/DC-524


500 | Internal Server Error | Doctrine_Connection_Pgsql_Exception
SQLSTATE[22003]: Numeric value out of range: 7 ERROR: input is out of range

You probably have the same problem that I got today..

I'm using NUMERIC on column type with precision 10, but the problem is not in the column latitude and longitude, it´s on calculation.

To resolve this problem I made a casting inside of ACOS function calculation, I tested it only in postgresql.

My DQL used to get all hotels around 3 kilometers of hotel id 189646

How to get the lastinsertid Doctrine

This example show how you can get the latest insert id on table continent.


$dbh = Doctrine_Manager::getInstance()->getCurrentConnection();
$sth = $dbh->prepare("INSERT INTO continent (created_at, updated_at) VALUES ( NOW(), NOW() )");
$sth->execute();

$conn = Doctrine_Manager::getInstance()->getCurrentConnection();
$conn->lastInsertId('continent_id');

Syndicate content