martes, 24 de septiembre de 2013

Creación de Entidades

joebuntu@casa-desktop:~/NetBeansProjects/petramas$ php app/console doctrine:generate:entity<ENTER>

  Welcome to the Doctrine2 entity generator 
This command helps you generate Doctrine2 entities.
First, you need to give the entity name you want to generate.
You must use the shortcut notation like AcmeBlogBundle:Post.

The Entity shortcut name: PetramasMainBundle:Usuario<ENTER>

Determine the format to use for the mapping information.

Configuration format (yml, xml, php, or annotation) [annotation]: <ENTER>

Instead of starting with a blank entity, you can add some fields now.
Note that the primary key will be added automatically (named id).

Available types: array, simple_array, json_array, object,
boolean, integer, smallint, bigint, string, text, datetime, datetimetz,
date, time, decimal, float, blob, guid.

New field name (press <return> to stop adding fields): nombre<ENTER>
Field type [string]: <ENTER>
Field length [255]: <ENTER>

New field name (press <return> to stop adding fields): <ENTER>

Do you want to generate an empty repository class [no]? yes<ENTER>
  Summary before generation 
You are going to generate a "PetramasMainBundle:Usuario" Doctrine2 entity
using the "annotation" format.

Do you confirm generation [yes]? <ENTER>
  Entity generation 
Generating the entity code: OK
  You can now start using the generated code! 

Para afinar la precisión de los campos decimal agregar precision y scale:

     * @var float
     * @ORM\Column(name="importe", type="decimal", precision=10, scale=2)
    private $importe;