Cant convert onetoone to onetomany in doctrine using symfony2 - php

I got hired about 2 weeks in a company, and my first task was to update and implement new features in an existing software written in symfony2-doctrine. But one of the changes I must make is just breaking my back.
The previous model was: one "cliente" (costumer) could have only one "credito" (credit) and one "credito" could have many "venta" (sales)
The new model should be: one "cliente" (costumer) can have many "credito" and one "credito" can have many "venta" (Im keeping the onetomany association for backwards compatibity)
This is how my entities look like this:
cliente.php
class Cliente {
//put your code here
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* #ORM\Column(type="string")
* #Assert\NotBlank()
*/
protected $nombre;
/**
* #ORM\Column(type="string", unique=true)
* #Assert\NotBlank()
*/
protected $documento;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $direccion;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $telefono;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $celular;
/**
* #ORM\Column(type="string", nullable=true)
* #Assert\Email()
*/
protected $email;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $ciudad;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $departamento;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $referenciaFamiliar;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $referenciaFamiliarTelefono;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $referenciaPersonal;
/**
* #ORM\Column(type="string", nullable=true)
*/
protected $referenciaPersonalTelefono;
/**
* #ORM\OneToMany(targetEntity="Credito", mappedBy="cliente", cascade={"all"})
*/
protected $credito;
/**
* #ORM\Column(type="string", nullable=true, length=255)
*/
protected $photo;
/**
* #Assert\File(maxSize="300k", mimeTypes={"image/jpeg","image/png"},mimeTypesMessage="Debe subir una imagen JPG o PNG",maxSizeMessage="La imagen no puede pesar más de 300 kb.")
*/
protected $file;
credito.php
class Credito {
//put your code here
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* #ORM\Column(type="string",nullable=true)
* #Assert\NotBlank()
*/
protected $cc;
/**
* #ORM\Column(type="datetime",nullable=false)
* #Assert\DateTime()
*/
protected $fechaRegistro;
/**
* #ORM\ManyToOne(targetEntity="Cliente",cascade={"persist"})
* #ORM\JoinColumn(name="cliente_id",referencedColumnName="id")
*/
protected $cliente;
/**
* #ORM\OneToMany(targetEntity="Venta", mappedBy="credito",cascade={"all"})
*/
protected $ventas;
/**
* #ORM\OneToMany(targetEntity="Abono", mappedBy="credito",cascade={"persist"})
*/
protected $abonos;
/**
* #ORM\Column(type="datetime",nullable=true)
* #Assert\DateTime()
*/
protected $fechaProximoPago;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\NotBlank()
*/
protected $valorProximoPago;
/**
* #ORM\Column(type="integer")
* #Assert\NotBlank()
*/
protected $cuotasTotales;
/**
* #ORM\Column(type="integer")
* #Assert\NotBlank()
*/
protected $cuotasPagadas;
/**
* #ORM\ManyToOne(targetEntity="ModoPagoNom")
* #ORM\JoinColumn(name="modo_pago_id",referencedColumnName="id")
*/
protected $modoPago;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\NotBlank()
*/
protected $valorFinanciado;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\NotBlank()
*/
protected $cupo;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\NotBlank()
*/
protected $cupoUsado;
venta.php
class Venta{
//put your code here
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* #ORM\Column(type="datetime")
* #Assert\DateTime()
*/
protected $fecha;
/**
* #ORM\Column(type="datetime")
* #Assert\DateTime()
*/
protected $fechaPrimerPago;
/**
* #ORM\Column(type="string")
* #Assert\NotBlank()
*/
protected $numeroFactura;
/**
* #ORM\Column(type="string")
* #Assert\NotBlank()
*/
protected $numeroAutorizo;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\Min(limit="0", message="El valor de la factura debe ser positivo")
*/
protected $valorFactura;
/**
* #ORM\Column(type="integer")
* #Assert\Type("integer")
* #Assert\Min(limit="1", message="Debe especificar al menos una cuota")
*/
protected $numeroCuotas;
/**
* #ORM\Column(type="integer")
* #Assert\Min(0)
*/
protected $cuotasPagadas;
/**
* #ORM\ManyToOne(targetEntity="ModoPagoNom")
* #ORM\JoinColumn(name="modo_pago_id",referencedColumnName="id")
*/
protected $modoPago;
/**
* #ORM\ManyToOne(targetEntity="Credito",cascade={"persist"})
* #ORM\JoinColumn(name="credito_id",referencedColumnName="id")
*/
protected $credito;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\Min(0.0)
*/
protected $valorFinanciado;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\Min(0.0)
*/
protected $valorCuota;
/**
* #ORM\Column(type="decimal",scale=3, precision=23)
* #Assert\Min(0.0)
*/
protected $valorPrimeraCuota;
/**
* #ORM\ManyToOne(targetEntity="Almacen")
* #ORM\JoinColumn(name="almacen_id",referencedColumnName="id")
*/
protected $almacen;
/**
* Get id
*
* #return integer
*/
The problem is: everytime I insert a new "credito", it wont be linked to the existing "cliente" instead of that, it will try to insert a duplicate entry of "cliente".
I've tried many things but none of them had any effect.
I appreciate any help, cause Im stuck with that.
If further information or code is required I will gladly provide it.

The cascade={"persist"} should be the core of your problem:
class Credito {
......
/**
* #ORM\ManyToOne(targetEntity="Cliente",cascade={"persist"})
* #ORM\JoinColumn(name="cliente_id",referencedColumnName="id")
*/
protected $cliente;
It tells doctrine to persist cleinte always when you persist Credito.
See docs for more details http://doctrine-orm.readthedocs.org/en/latest/reference/working-with-associations.html#transitive-persistence-cascade-operations

Always tell Doctrine how to do in both sides of an association :
// credito.php
/**
* #ORM\ManyToOne(targetEntity="Cliente", inversedBy="credito", cascade={"persist"})
* #ORM\JoinColumn(name="cliente_id",referencedColumnName="id")
*/
protected $cliente;
And
// venta.php
/**
* #ORM\ManyToOne(targetEntity="Credito", inversedBy="ventas", cascade={"persist"})
* #ORM\JoinColumn(name="credito_id",referencedColumnName="id")
*/
protected $credito;

Related

Doctrine & Symfony - No hydratation data from custom query

Good afternoon,
I try to get all data with one DQL query in a specific Repository.
The problem is, even if I have Host & Page[] (collection), the query returns null values for this entities.
This is my entities ([EDIT] after question by delboy1978uk):
/**
* #ORM\Entity(repositoryClass="App\Repository\WebsiteRepository")
*/
class Website
{
/**
* #var int|null $id
*
* #ORM\Id
* #ORM\Column(type="integer")
*/
private $id;
/**
* #var string $domainName
*
* #ORM\Column(type="string", length=255, nullable=false)
*/
private $domainName;
/**
* #var string $language
*
* #ORM\Column(type="string", length=2, nullable=false)
*/
private $language;
/**
* #var Host $host
*
* #ORM\ManyToOne(targetEntity="App\Entity\Host", cascade={"persist"})
* #ORM\JoinColumn(name="host_id", referencedColumnName="id", nullable=false)
*/
private $host;
/**
* #var ArrayCollection $pages
*
* #ORM\OneToMany(targetEntity="App\Entity\Page", mappedBy="website", cascade={"persist"})
*/
private $pages;
/**
* Website constructor.
*/
public function __construct()
{
$this->pages = new ArrayCollection();
}
}
/**
* #ORM\Entity(repositoryClass="App\Repository\HostRepository")
*/
class Host
{
/**
* #var int|null $id
*
* #ORM\Id
* #ORM\Column(type="integer")
*/
private $id;
/**
* #var string|null
*
* #ORM\Column(type="string", length=255, nullable=false)
*/
private $legalName;
/**
* #var string|null
*
* #ORM\Column(type="string", length=255, nullable=false)
*/
private $address;
/**
* #var string|null
*
* #ORM\Column(type="string", length=15, nullable=false)
*/
private $phoneNumber;
}
/**
* #ORM\Entity(repositoryClass="App\Repository\PageRepository")
*/
class Page
{
/**
* #var int|null $id
*
* #ORM\Id
* #ORM\GeneratedValue
* #ORM\Column(type="integer")
*/
private $id;
/**
* #var string|null $title
*
* #ORM\Column(type="string", length=255, nullable=false)
*/
private $title;
/**
* #var string|null $route
*
* #ORM\Column(type="string", length=255, nullable=false)
*/
private $route;
/**
* #var string|null $template
*
* #ORM\Column(type="string", length=255, nullable=false)
*/
private $template;
/**
* #var Website $website
*
* #ORM\ManyToOne(targetEntity="App\Entity\Website", inversedBy="pages")
*/
private $website;
}
This is my method to find configuration ([EDIT] after question by delboy1978uk):
class WebsiteRepository extends ServiceEntityRepository
{
/**
* WebsiteRepository constructor.
*
* #param ManagerRegistry $registry
*/
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Website::class);
}
public function findConfiguration(): array
{
return $this->getEntityManager()->createQuery(
'SELECT w
FROM App\Entity\Website w
JOIN w.host h
LEFT JOIN w.pages p'
)->getResult();
}
}
I expect to returns Host & Page[] (collection) from findConfiguration method in WebsiteRepository.
Thanks you for your help.
This is the solution with findConfiguration method in WebsiteRepository for findConfiguration method:
SELECT w, h, p
FROM App\Entity\Website w
LEFT JOIN w.host h
LEFT JOIN w.pages p

Check if a user already made a submission with Doctrine- Symfony 3

I have 3 entities which are User, Problem and Submission. I'm trying to restrict a user from solving the same question more than once if that user already solved it. I created a method in User entity by checking the Submissions for each user. However I couldn't figure out a way to match the problem_id and user_id fields so I can see if the submission was correct or not.
Here are the entites;
Problem.php
class Problem
{
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #ORM\Column(type="string", length=255, unique=True)
* #Assert\NotBlank(message="Please enter a valid title")
*/
protected $title;
/**
* #ORM\Column(type="text")
* #Assert\NotBlank(message="Please enter a valid description")
*/
protected $description;
/**
* #ORM\Column(type="string")
* #Assert\NotBlank(message="Please enter a valid value")
*/
protected $points;
/**
* #ORM\Column(type="string")
* #Assert\NotBlank(message="Please enter a valid flag")
*/
protected $flag;
/**
* #ORM\Column(type="string")
* #Assert\NotBlank(message="Please enter a valid value")
*/
protected $category;
/**
* #ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="problems")
* #ORM\JoinColumn(name="createdby", referencedColumnName="id")
*/
protected $createdby;
/**
* #ORM\OneToMany(targetEntity="AppBundle\Entity\Submission", mappedBy="problem_id")
*/
protected $submissions;
/**
* #Gedmo\Slug(fields={"title"})
* #ORM\Column(type="string", length=255, unique=false,)
*/
protected $slug;
/**
* #ORM\Column(type="datetime")
*/
private $createdAt;
/**
* #ORM\Column(type="datetime")
*/
private $updatedAt;
/**
* #ORM\OneToMany(targetEntity="AppBundle\Entity\Discussion", mappedBy="problem")
*/
private $discussions;
/**
* #ORM\Column(type="boolean")
*/
protected $isPublished = True;
}
Submission.php
class Submission
{
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #ORM\ManyToOne(targetEntity="AppBundle\Entity\Problem", inversedBy="submissions")
* #ORM\JoinColumn(name="problem_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $problem_id;
/**
* #ORM\Column(type="boolean")
*/
protected $correct = false;
/**
* #ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="submissions")
* #ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $user_id;
/**
* #ORM\Column(type="string")
* #Assert\NotBlank(message="Flag cannot be blank")
*/
protected $submission_flag;
/**
* #ORM\Column(type="datetime")
*/
private $createdAt;
/**
* #ORM\Column(type="datetime")
*/
private $updatedAt;
}
User.php
class User implements UserInterface
{
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #ORM\Column(type="string", length=255, unique=true)
* #Assert\NotBlank(message="Please enter a valid email address")
* #Assert\Email()
*/
private $username;
/**
* #ORM\Column(type="string", length=255, unique=true)
* #Assert\NotBlank(message="Please enter a valid email address")
*/
private $usrname;
/**
* #Assert\NotBlank()
* #Assert\Length(max=4096)
*/
private $plainPassword;
/**
* The below length depends on the "algorithm" you use for encoding
* the password, but this works well with bcrypt.
*
* #ORM\Column(type="string", length=64)
*/
private $password;
/**
* #ORM\Column(type="string", length=255, unique=true)
* #Assert\NotBlank(message="Please enter a valid name")
*/
private $fullname;
/**
* #var array
* #ORM\Column(name="roles", type="json_array")
*/
protected $roles;
/**
* #ORM\OneToMany(targetEntity="AppBundle\Entity\Problem", mappedBy="createdby")
*/
protected $problems;
/**
* #ORM\OneToMany(targetEntity="AppBundle\Entity\Feed", mappedBy="createdby")
*/
protected $feeds;
/**
* #ORM\OneToMany(targetEntity="AppBundle\Entity\Comment", mappedBy="createdby")
*/
protected $comments;
/**
* #ORM\OneToMany(targetEntity="AppBundle\Entity\Submission", mappedBy="user_id")
*/
protected $submissions;
}
You may be able to try #UniqueConstraint on your Submission entity. Something like:
/**
* #Entity
* #Table(uniqueConstraints={#UniqueConstraint(name="unique_user_submission", columns={"name", "email"})})
*/
class Submission
{
}
I think that'll make those two fields a composite unique field.
http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/annotations-reference.html#annref-uniqueconstraint

How to right insert or update on same Doctrine2 object

I have this piece of code:
$entity = $em->getRepository('AppBundle:Representative')->find($soqlObj1['records'][0]['Id']);
if ($entity === null) {
$entity = new Representative();
$em->persist($entity);
}
// we set the values from veeva
$entity->setVeevaRepId($soqlObj1['records'][0]['Id']);
$entity->setEmail($soqlObj1['records'][0]['Email']);
...
$em->flush();
And this is part of the entity Representative:
class Representative
{
/**
* #ORM\Id()
* #ORM\Column(type="string", length=45, nullable=false, unique=true)
* #ORM\GeneratedValue()
* #Expose()
*/
protected $veeva_rep_id;
/**
* #var string
* #ORM\Column(type="string", length=45)
* #Expose()
*/
protected $display_name;
/**
* #var string
* #ORM\Column(type="string", length=255)
* #Expose()
*/
protected $avatar_url = 'https://pdone.s3.amazonaws.com/avatar/default_avatar.png';
/**
* #var string
* #ORM\Column(type="string", length=45)
* #Expose()
*/
protected $rep_type = "VEEVA";
/**
* #var string
* #ORM\Column(type="string", length=45)
* #Expose()
*/
protected $username;
/**
* #var string
* #ORM\Column(type="string", length=45)
* #Expose()
*/
protected $first;
/**
* #var string
* #ORM\Column(type="string", length=45)
* #Expose()
*/
protected $last;
/**
* #var string
* #ORM\Column(type="string", length=45, nullable=true)
* #Expose()
*/
protected $title;
/**
* #var string
* #ORM\Column(type="text", nullable=true)
*/
protected $bio;
/**
* #var string
* #ORM\Column(type="string", length=45, nullable=true)
* #Expose()
*/
protected $phone;
/**
* #var string
* #ORM\Column(type="string", length=45)
* #Expose()
*/
protected $email;
/**
* #var bool
* #ORM\Column(type="boolean")
* #Expose()
*/
protected $inactive = false;
/**
* #var \DateTime
* #ORM\Column(type="datetime", nullable=true)
* #Expose()
*/
protected $lastLoginAt;
/**
* #var \DateTime
* #ORM\Column(type="datetime")
* #Expose()
*/
protected $lastSyncAt;
/**
* #var Territory
* #ORM\ManyToOne(targetEntity="Territory")
* #ORM\JoinColumn(name="territories_id", referencedColumnName="veeva_territory_id")
* #Expose()
*/
protected $territory;
/**
* #var string
* #ORM\Column(type="string", nullable=true, length=150)
*/
protected $repTokenId;
...
}
There are a few others columns that are required at DB level (nullable = false at entity level), my question: if the object doesn't exists at DB it will be created or update based on the code I wrote or I need to move each required field into conditional? Which is the right way to achieve this? I am trying to do a INSERT|UPDATE based on just one query result
If you retrieved object from db, doctrine itself knows if the next operation will be an update or an insert: you don't have to worry about anything
Your answer is a valid one but I would modify it as follows
$entity = $em->getRepository('AppBundle:Representative')->find($soqlObj1['records'][0]['Id']);
if ($entity === null) {
$entity = new Representative();
}
// we set the values from veeva
$entity->setVeevaRepId($soqlObj1['records'][0]['Id']);
$entity->setEmail($soqlObj1['records'][0]['Email']);
$em->persist($entity);
$em->flush();
As I told you, you don't have to worry about insertion or update, doctrine will do it for you. However, if you need to set certain values only if the object is a new one or if it was fetched from db, just add proper code under $entity === null control

Doctrine - ManyToOne with table between

I want to create model which will have table users with reference to table CustomFieldValue nad table CustomField with reference to CustomFieldValue too. CustomFieldValue will have only id, value and two columns, one from users and second from CustomField. I want to have functionality like a dynamic adding a new fields in registration form. Is this good idea? If yes, please help me with this model, because it doesn't work:
User:
/**
* #ORM\Column(type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #ORM\Column(type="string", length=25, unique=true)
*/
private $username;
/**
* #ORM\Column(type="string", length=64)
*/
private $password;
/**
* #ORM\ManyToMany(targetEntity="Role", inversedBy="users",cascade={"persist"})
*
*/
private $roles;
/**
* #ORM\Column(type="string", length=60, unique=true)
*/
private $email;
/**
* #ORM\Column(type="string", length=60)
*/
private $sex;
/**
* #ORM\ManyToMany(targetEntity="Region", inversedBy="users")
* #ORM\JoinColumn(name="region", referencedColumnName="id")
*/
private $region;
/**
* #ORM\ManyToMany(targetEntity="Type", inversedBy="users")
* #ORM\JoinColumn(name="type", referencedColumnName="id")
*/
private $type;
/**
* #ORM\Column(name="is_active", type="boolean")
*/
private $isActive;
/**
* #ORM\ManyToOne(targetEntity="CustomFieldValue",inversedBy="id")
* #ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $customValues;
CustomFieldValue:
/**
* #var integer
*
* #ORM\Column(name="id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #var string
*
* #ORM\Column(name="value", type="string", length=255)
*/
private $value;
/**
*ORM\OneToMany(targetEntity="User", mapped-by="id")
*#ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
*#ORM\OneToMany(targetEntity="CustomField", mapped-by="id" )
*#ORM\JoinColumn(name="field_id", referencedColumnName="id")
*/
private $field;
CustomField:
/**
* #var integer
*
* #ORM\Column(name="id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #var string
*
* #ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* #var string
*
* #ORM\Column(name="type", type="string", length=255)
*/
private $type;
/**
* #var boolean
*
* #ORM\Column(name="required", type="boolean")
*/
private $required;
/**
* #ORM\ManyToOne(targetEntity="CustomFieldValue", inversedBy="id")
* #ORM\JoinColumn(name="customfield_id", referencedColumnName="id")
*/
private $customValues;
Your mapping is a little off:
User Entity Should Be:
/**
* #ORM\ManyToOne(targetEntity="CustomFieldValue", inversedBy="user")
* #ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $customValues;
CustomFieldValue Should Be:
/**
*ORM\OneToMany(targetEntity="User", mappedBy="customValues")
*/
private $user;
/**
*#ORM\OneToMany(targetEntity="CustomField", mappedBy="customValues" )
*/
private $field;
CustomField should be:
/**
* #ORM\ManyToOne(targetEntity="CustomFieldValue", inversedBy="field")
* #ORM\JoinColumn(name="customfield_id", referencedColumnName="id")
*/
private $customValues;
You dont need the join columns when you are calling the mappedBy this already tells doctrine to look for the join column declaration on that field. For the mappedBy and inversedBy fields these are the fields that link the 2 together NOT the actual join column name.

Symfony 2 trouble with Single Table Inheritance

I'm new to Symfony and Doctrine and I'm trying to implement a simple user registration system with two types of users, a Client and an Expert.
I have an abstract class Usuario with common data that both users share and the other two which extend from it.
The problem is that when I run the command app/console doctrine:schema:update, it generates the table Usuario with all fields of the Usuario class but only one from the Experto class.
Here is my 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 and 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 is a table called Usuario with all properties of the class usuario and only the property nombre_negocio of the Experto class.
Any ideas what I'm doing wrong?
Thanks in advance.

Categories