08/08/2012, 19:25
|
| | Fecha de Ingreso: agosto-2012
Mensajes: 6
Antigüedad: 12 años, 3 meses Puntos: 0 | |
Respuesta: guardar los datos del usuario junto al Formulario Si, el usuario Logueado, necesito luego guardarlo en la base de datos, te agrego las Entidades:
Código:
Entidad Usuario
namespace scge\scgeBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use scge\scgeBundle\Validator\RUT;
use scge\scgeBundle\Entity\Comuna;
/**
* scge\scgeBundle\Entity
*
* @ORM\Table(name="usuarios")
* @ORM\Entity
*/
class Usuario
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @RUT()
*/
protected $rut;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
*/
protected $serial_rut;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @Assert\MinLength(3)
* @Assert\MaxLength(50)
*/
protected $nombre;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @Assert\MinLength(3)
* @Assert\MaxLength(50)
*/
protected $apellidos;
/**
* @ORM\ManyToOne(targetEntity="Comuna", inversedBy="usuarios", cascade={"remove"})
* @ORM\JoinColumn(name="comunas_id", referencedColumnName="id")
*/
protected $comuna;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
*/
protected $direccion;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
*/
protected $fono;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
*/
protected $movil;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @Assert\MinLength(5)
* @Assert\MaxLength(100)
*/
protected $email;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @Assert\MinLength(5)
* @Assert\MaxLength(10)
*/
protected $password;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @Assert\MinLength(5)
* @Assert\MaxLength(10)
* @Assert\Choice({"ROLE_USER", "ROLE_ADMIN"})
*/
protected $rol;
/**
* @ORM\Column(type="integer")
*/
protected $gastolimite;
/**
* @ORM\Column(type="string", length="2")
* @Assert\Choice({"si", "no"})
*/
protected $bloqueado;
/**
* @ORM\OneToMany(targetEntity="Egreso", mappedBy="usuario")
*/
protected $egreso;
/**
* @ORM\OneToMany(targetEntity="Ingreso", mappedBy="usuario")
*/
protected $ingreso;
}
Código:
ENTIDAD INGRESO
<?php
namespace scge\scgeBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* scge\scgeBundle\Entity
*
* @ORM\Table(name="ingresos")
* @ORM\Entity
*/
class Ingreso
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;
/**
* @ORM\Column(type="integer")
*/
protected $numero;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
*/
protected $RUT;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank()
* @Assert\MinLength(3)
* @Assert\MaxLength(70)
*/
protected $nombre;
/**
* @ORM\Column(type="date")
*/
protected $fecha;
/**
* @ORM\ManyToOne(targetEntity="TipoDoc", inversedBy="ingresos", cascade={"remove"})
* @ORM\JoinColumn(name="tipodoc_id", referencedColumnName="id")
*/
protected $tipodoc;
/**
* @ORM\Column(type="text")
*/
protected $glosa;
/**
* @ORM\Column(type="integer")
*/
protected $Monto;
/**
* @ORM\Column(type="integer", length="1")
*/
protected $nula;
/**
* @ORM\Column(type="integer", length="1")
*/
protected $estado;
/**
* @ORM\ManyToOne(targetEntity="PlanCta", inversedBy="ingresos", cascade={"remove"})
* @ORM\JoinColumn(name="plancta_id", referencedColumnName="id")
*/
protected $ctacont;
/**
* @ORM\ManyToOne(targetEntity="Usuario", inversedBy="ingresos", cascade={"remove"})
* @ORM\JoinColumn(name="usuario_id", referencedColumnName="id")
*/
protected $usuario;
|