php - Symfony 2 trouble with Single Table Inheritance -


i'm new symfony , doctrine , i'm trying implement simple user registration system 2 types of users, client , expert.

i have abstract class usuario common data both users share , other 2 extend it.

the problem when run command app/console doctrine:schema:update, generates table usuario fields of usuario class 1 experto class.

here code:

class usuario:

/**  * usuario  *  * @orm\entity  * @orm\table(name="usuario")  * @orm\inheritancetype("single_table")  * @orm\discriminatorcolumn(name="tipo", type="string")  * @orm\discriminatormap( {"cliente" = "cliente", "experto" = "experto"} )  */  abstract class usuario { /**  * @var integer  *  * @orm\id  * @orm\column(name="id", type="integer")  * @orm\generatedvalue(strategy="auto")  */ protected $id;  /**  * @var string $nombre  *  * @orm\column(name="nombre", type="string", length=255)  */ protected $nombre;  /**  * @var string $email  *  * @orm\column(name="email", type="string", length=255)  */ protected $email;  /**  * @var string $password  *  * @orm\column(name="password", type="string", length=32)  */ protected $password;  /**  * @var \datetime $fecha_registro  *  * @orm\column(name="fecha_registro", type="datetime")  */  setters , getters 

class experto:

/**  * experto  *  * @orm\entity(repositoryclass="quienlorepara\usuariosbundle\entity\expertorepository")  */ class experto extends usuario { /**   * @var string $nombre_negocio  *  * @orm\column(name="nombre_negocio", type="string", length=255)  */ protected $nombre_negocio;  /*  * @var text $descrip_negocio  *  * @orm\column(name="descrip_negocio", type="text")  */ protected $descrip_negocio;  /*  * @var string $descripcion  *  * @orm\column(name="direccion", type="string", length=255)  */ protected $direccion;  /*  * @var string $telefono  *  * @orm\column(name="telefono", type="string", length=255)  */ protected $telefono;  /*  * @var string $actividad  *  * @orm\column(name="actividad", type="string", length=255)  */ protected $actividad;  /*  * @var decimal $latitud  *  * @orm\column(name="latitud", type="decimal", precision=10, scale=8)  */ protected $latitud;  /*  * var decimal $longitud  *  * @orm\column(name="longitud", type="decimal", precision=11, scale=8)  */ protected $longitud;  /**   * @var collection  * @orm\onetomany(targetentity="skill", mappedby="experto")  * @orm\joincolumn(name="usuario_id", referencedcolumnname="id")  */ protected $skills; 

the result table called usuario properties of class usuario , property nombre_negocio of experto class. ideas i'm doing wrong? in advance.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -