[DC-1014] Geographical behaviour generates wrong INSERT statement in PostgreSQL if latitude/logitude not specified Created: 01/Jul/11  Updated: 01/Jul/11

Status: Open
Project: Doctrine 1
Component/s: Geographical
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Lorenzo Nicora Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Symphony 1.4, PostgreSQL 8.4.8



 Description   

Added "Geographical" behaviour to an entity:

 
ZipCode:
  actAs: [Geographical]
  columns:
    code: string
    [...]

Using the standard Symfony-generated admin manager, when trying to insert a new record without specifying both latitude and longitude, Doctrine generates a wrong INSERT statement for PostgreSQL, including latitude and longitude as '' (empty string)

 
Doctrine_Connection->exec('INSERT INTO zip_code (hidden, code,  country_id, latitude, longitude) VALUES (?, ?, ?, ?, ?)', array('false', '20133', '1', '', ''))

This cause this error:
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type double precision: ""

Workaround

explicitly specifying float type for latitude and longitude...

 
  actAs: 
    Geographical:
      latitude: {type: float}
      longitude: {type: float}

...still generate the column correctly as double precision in the database, but will not cause any error on inserting records.






Generated at Tue Sep 02 01:58:21 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.