Data types for Latitude/Longitude on Doctrine 2 with YAML

NameI’m a devote Doctrine 1.2 user but times are changing and now I’m faced with the challenge of learning and updating all of my applications to use the brand new Doctrine 2.2 framework.

Doctrine 2.2 has been completely renewed and a lot of cool stuff from Doctrine 1.2 has dissapeared, one that will be missed the most I’m sure is the auto-magic the behaviours provided, this said some new challeneges arise, for example, what type of data to use to store basic data like latitud and longitud since the Geographical behaviour is now gone.

A solution I’ve find is to use decimal type of data with a size of 18,12, so if you are defining your models with YAML like I do you can do the following:

 

 

Entities\City:
  type: entity
  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO      
    name:
      type: string(255)
    latitude:
      type: decimal(18)
      scale: 12
      precision: 18
      nullable: true
    longitude:
      type: decimal(18)
      scale: 12
      precision: 18
      nullable: true

With this type of data I fixed my need of storing latitude and longitud data.

One thought on “Data types for Latitude/Longitude on Doctrine 2 with YAML

  1. Your v speaks before everything else and it matters a lot at workplace. You befitting someone or make a transit by casually, and the first thing that they observation is what you are wearing. The impression that you make with your align influences the way in which you are evaluated as an employee.

Leave a Reply to Cheap Moncler Outlet Online Sale UK Cancel reply

Your email address will not be published. Required fields are marked *