Ver Mensaje Individual
  #10 (permalink)  
Antiguo 22/10/2012, 14:33
Victoor
 
Fecha de Ingreso: agosto-2007
Mensajes: 14
Antigüedad: 17 años
Puntos: 0
Respuesta: Problema con formulario y clave foranea

Opinion.php
Código PHP:
Ver original
  1. <?php
  2.  
  3. namespace BestSup\OpinionesBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7.  
  8. /**
  9.  * BestSup\OpinionesBundle\Entity\Opinion
  10.  *
  11.  * @ORM\Table()
  12.  * @ORM\Entity
  13.  */
  14. class Opinion
  15. {
  16.     /**
  17.      * @var integer $id
  18.      *
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.  
  25.     /**
  26.      * @var integer $articulo
  27.      *
  28.      * @ORM\ManyToOne(targetEntity="BestSup\ArticuloBundle\Entity\Articulo")
  29.      */
  30.     private $articulo;
  31.  
  32.     /**
  33.      * @var integer $usuario
  34.      *
  35.      * @ORM\ManyToOne(targetEntity="BestSup\UserBundle\Entity\User")
  36.      */
  37.     private $usuario;
  38.  
  39.     /**
  40.      * @var text $opinion
  41.      *
  42.      * @Assert\MinLength(limit=400, message="La opinión es demasiado corta. (Al menos 400 caracteres).")
  43.      *
  44.      * @ORM\Column(name="opinion", type="text")
  45.      */
  46.     private $opinion;
  47.  
  48.     /**
  49.      * @var integer $sabor
  50.      *
  51.      * @Assert\Max(limit = 10, message = "Debe ser un valor entre 0 y 10.")
  52.      * @Assert\min(limit = 0, message = "Debe ser un valor entre 0 y 10.")
  53.      *
  54.      * @ORM\Column(name="sabor", type="integer")
  55.      */
  56.     private $sabor;
  57.  
  58.     /**
  59.      * @var integer $calidadprecio
  60.      *
  61.      * @Assert\Max(limit = 10, message = "Debe ser un valor entre 0 y 10.")
  62.      * @Assert\min(limit = 0, message = "Debe ser un valor entre 0 y 10.")
  63.      *
  64.      * @ORM\Column(name="calidadprecio", type="integer")
  65.      */
  66.     private $calidadprecio;
  67.  
  68.     /**
  69.      * @var integer $efectividad
  70.      *
  71.      * @Assert\Max(limit = 10, message = "Debe ser un valor entre 0 y 10.")
  72.      * @Assert\min(limit = 0, message = "Debe ser un valor entre 0 y 10.")
  73.      *
  74.      * @ORM\Column(name="efectividad", type="integer")
  75.      */
  76.     private $efectividad;
  77.  
  78.     /**
  79.      * @var integer $probado
  80.      *
  81.      * @ORM\Column(name="probado", type="integer")
  82.      */
  83.     private $probado;
  84.  
  85.     /**
  86.      * @var integer $pros
  87.      *
  88.      * @ORM\ManyToMany(targetEntity="BestSup\OpinionesBundle\Entity\Pros", cascade={"persist"})
  89.      */
  90.     private $pros;
  91.  
  92.     /**
  93.      * @var integer $contras
  94.      *
  95.      * @ORM\ManyToMany(targetEntity="BestSup\OpinionesBundle\Entity\Contras", cascade={"persist"})
  96.      */
  97.     private $contras;
  98.  
  99.  
  100.     /**
  101.      * Get id
  102.      *
  103.      * @return integer
  104.      */
  105.     public function getId()
  106.     {
  107.         return $this->id;
  108.     }
  109.  
  110.     /**
  111.      * Set articulo
  112.      *
  113.      * @param integer $articulo
  114.      */
  115.     public function setArticulo($articulo)
  116.     {
  117.         $this->articulo = $articulo;
  118.     }
  119.  
  120.     /**
  121.      * Get articulo
  122.      *
  123.      * @return integer
  124.      */
  125.     public function getArticulo()
  126.     {
  127.         return $this->articulo;
  128.     }
  129.  
  130.     /**
  131.      * Set usuario
  132.      *
  133.      * @param integer $usuario
  134.      */
  135.     public function setUsuario($usuario)
  136.     {
  137.         $this->usuario = $usuario;
  138.     }
  139.  
  140.     /**
  141.      * Get usuario
  142.      *
  143.      * @return integer
  144.      */
  145.     public function getUsuario()
  146.     {
  147.         return $this->usuario;
  148.     }
  149.  
  150.     /**
  151.      * Set opinion
  152.      *
  153.      * @param text $opinion
  154.      */
  155.     public function setOpinion($opinion)
  156.     {
  157.         $this->opinion = $opinion;
  158.     }
  159.  
  160.     /**
  161.      * Get opinion
  162.      *
  163.      * @return text
  164.      */
  165.     public function getOpinion()
  166.     {
  167.         return $this->opinion;
  168.     }
  169.  
  170.     /**
  171.      * Set sabor
  172.      *
  173.      * @param integer $sabor
  174.      */
  175.     public function setSabor($sabor)
  176.     {
  177.         $this->sabor = $sabor;
  178.     }
  179.  
  180.     /**
  181.      * Get sabor
  182.      *
  183.      * @return integer
  184.      */
  185.     public function getSabor()
  186.     {
  187.         return $this->sabor;
  188.     }
  189.  
  190.     /**
  191.      * Set calidadprecio
  192.      *
  193.      * @param integer $calidadprecio
  194.      */
  195.     public function setCalidadPrecio($calidadprecio)
  196.     {
  197.         $this->calidadprecio = $calidadprecio;
  198.     }
  199.  
  200.     /**
  201.      * Get calidadprecio
  202.      *
  203.      * @return integer
  204.      */
  205.     public function getCalidadPrecio()
  206.     {
  207.         return $this->calidadprecio;
  208.     }
  209.  
  210.     /**
  211.      * Set efectividad
  212.      *
  213.      * @param integer $efectividad
  214.      */
  215.     public function setEfectividad($efectividad)
  216.     {
  217.         $this->efectividad = $efectividad;
  218.     }
  219.  
  220.     /**
  221.      * Get efectividad
  222.      *
  223.      * @return integer
  224.      */
  225.     public function getEfectividad()
  226.     {
  227.         return $this->efectividad;
  228.     }
  229.  
  230.     /**
  231.      * Set probado
  232.      *
  233.      * @param integer $probado
  234.      */
  235.     public function setProbado($probado)
  236.     {
  237.         $this->probado = $probado;
  238.     }
  239.  
  240.     /**
  241.      * Get probado
  242.      *
  243.      * @return integer
  244.      */
  245.     public function getProbado()
  246.     {
  247.         return $this->probado;
  248.     }
  249.  
  250.     /**
  251.      * Set pros
  252.      *
  253.      * @param integer $pros
  254.      */
  255.     public function setPros($pros)
  256.     {
  257.         $this->pros = $pros;
  258.     }
  259.  
  260.     /**
  261.      * Get pros
  262.      *
  263.      * @return integer
  264.      */
  265.     public function getPros()
  266.     {
  267.         return $this->pros;
  268.     }
  269.     public function __construct()
  270.     {
  271.         $this->pros = new \Doctrine\Common\Collections\ArrayCollection();
  272.     }
  273.    
  274.     /**
  275.      * Add pros
  276.      *
  277.      * @param BestSup\OpinionesBundle\Entity\Pros $pros
  278.      */
  279.     public function addPros(\BestSup\OpinionesBundle\Entity\Pros $pros)
  280.     {
  281.         $this->pros[] = $pros;
  282.     }
  283.  
  284.     /**
  285.      * Set contras
  286.      *
  287.      * @param integer $contras
  288.      */
  289.     public function setContras($contras)
  290.     {
  291.         $this->contras = $contras;
  292.     }
  293.  
  294.     /**
  295.      * Get contras
  296.      *
  297.      * @return integer
  298.      */
  299.     public function getContras()
  300.     {
  301.         return $this->contras;
  302.     }
  303.    
  304.     /**
  305.      * Add contras
  306.      *
  307.      * @param BestSup\OpinionesBundle\Entity\Contras $contras
  308.      */
  309.     public function addContras(\BestSup\OpinionesBundle\Entity\Contras $contras)
  310.     {
  311.         $this->contras[] = $contras;
  312.     }
  313. }