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

Articulos.php
Código PHP:
Ver original
  1. <?php
  2.  
  3. namespace BestSup\ArticuloBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use BestSup\ArticuloBundle\Util\Util;
  7.  
  8. /**
  9.  * BestSup\ArticuloBundle\Entity\Articulo
  10.  *
  11.  * @ORM\Table()
  12.  * @ORM\Entity
  13.  */
  14. class Articulo
  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 string $nombre
  27.      *
  28.      * @ORM\Column(name="nombre", type="string", length=255)
  29.      */
  30.     private $nombre;
  31.  
  32.     /**
  33.      * @var text $descripcion
  34.      *
  35.      * @ORM\Column(name="descripcion", type="text")
  36.      */
  37.     private $descripcion;
  38.  
  39.     /**
  40.      * @var string $imagen
  41.      *
  42.      * @ORM\Column(name="imagen", type="string", length=255)
  43.      */
  44.     private $imagen;
  45.  
  46.     /**
  47.      * @var string $slug
  48.      *
  49.      * @ORM\Column(name="slug", type="string", length=255)
  50.      */
  51.     private $slug;
  52.  
  53.     /**
  54.      * @var datetime $fecha_alta
  55.      *
  56.      * @ORM\Column(name="fecha_alta", type="datetime")
  57.      */
  58.     private $fecha_alta;
  59.  
  60.     /**
  61.      * @var datetime $fecha_modificacion
  62.      *
  63.      * @ORM\Column(name="fecha_modificacion", type="datetime")
  64.      */
  65.     private $fecha_modificacion;
  66.  
  67.     /**
  68.      * @var float $nota
  69.      *
  70.      * @ORM\Column(name="nota", type="float")
  71.      */
  72.     private $nota;
  73.  
  74.     /**
  75.      * @var integer $categoria
  76.      *
  77.      * @ORM\ManyToOne(targetEntity="BestSup\ArticuloBundle\Entity\Categoria")
  78.      */
  79.     private $categoria;
  80.  
  81.     /**
  82.      * @var integer $marca
  83.      *
  84.      * @ORM\ManyToOne(targetEntity="BestSup\ArticuloBundle\Entity\Marca")
  85.      */
  86.     private $marca;
  87.  
  88.  
  89.     /**
  90.      * Get id
  91.      *
  92.      * @return integer
  93.      */
  94.     public function getId()
  95.     {
  96.         return $this->id;
  97.     }
  98.  
  99.     /**
  100.      * Set nombre
  101.      *
  102.      * @param string $nombre
  103.      */
  104.     public function setNombre($nombre)
  105.     {
  106.         $this->nombre = $nombre;
  107.         $this->slug = Util::getSlug($nombre);
  108.     }
  109.  
  110.     /**
  111.      * Get nombre
  112.      *
  113.      * @return string
  114.      */
  115.     public function getNombre()
  116.     {
  117.         return $this->nombre;
  118.     }
  119.  
  120.     /**
  121.      * Set descripcion
  122.      *
  123.      * @param text $descripcion
  124.      */
  125.     public function setDescripcion($descripcion)
  126.     {
  127.         $this->descripcion = $descripcion;
  128.     }
  129.  
  130.     /**
  131.      * Get descripcion
  132.      *
  133.      * @return text
  134.      */
  135.     public function getDescripcion()
  136.     {
  137.         return $this->descripcion;
  138.     }
  139.  
  140.     /**
  141.      * Set imagen
  142.      *
  143.      * @param string $imagen
  144.      */
  145.     public function setImagen($imagen)
  146.     {
  147.         $this->imagen = $imagen;
  148.     }
  149.  
  150.     /**
  151.      * Get imagen
  152.      *
  153.      * @return string
  154.      */
  155.     public function getImagen()
  156.     {
  157.         return $this->imagen;
  158.     }
  159.  
  160.     /**
  161.      * Set slug
  162.      *
  163.      * @param string $slug
  164.      */
  165.     public function setSlug($slug)
  166.     {
  167.         $this->slug = $slug;
  168.     }
  169.  
  170.     /**
  171.      * Get slug
  172.      *
  173.      * @return string
  174.      */
  175.     public function getSlug()
  176.     {
  177.         return $this->slug;
  178.     }
  179.  
  180.     /**
  181.      * Set fecha_alta
  182.      *
  183.      * @param datetime $fechaAlta
  184.      */
  185.     public function setFechaAlta($fechaAlta)
  186.     {
  187.         $this->fecha_alta = $fechaAlta;
  188.     }
  189.  
  190.     /**
  191.      * Get fecha_alta
  192.      *
  193.      * @return datetime
  194.      */
  195.     public function getFechaAlta()
  196.     {
  197.         return $this->fecha_alta;
  198.     }
  199.  
  200.     /**
  201.      * Set fecha_modificacion
  202.      *
  203.      * @param datetime $fechaModificacion
  204.      */
  205.     public function setFechaModificacion($fechaModificacion)
  206.     {
  207.         $this->fecha_modificacion = $fechaModificacion;
  208.     }
  209.  
  210.     /**
  211.      * Get fecha_modificacion
  212.      *
  213.      * @return datetime
  214.      */
  215.     public function getFechaModificacion()
  216.     {
  217.         return $this->fecha_modificacion;
  218.     }
  219.  
  220.     /**
  221.      * Set nota
  222.      *
  223.      * @param float $nota
  224.      */
  225.     public function setNota($nota)
  226.     {
  227.         $this->nota = $nota;
  228.     }
  229.  
  230.     /**
  231.      * Get nota
  232.      *
  233.      * @return float
  234.      */
  235.     public function getNota()
  236.     {
  237.         return $this->nota;
  238.     }
  239.  
  240.     /**
  241.      * Set categoria
  242.      *
  243.      * @param integer $categoriaId
  244.      */
  245.     public function setCategoriaId(\BestSup\ArticuloBundle\Entity\Categoria $categoriaId)
  246.  
  247.     {
  248.         $this->categoria = $categoriaId;
  249.     }
  250.  
  251.     /**
  252.      * Get categoria
  253.      *
  254.      * @return integer
  255.      */
  256.     public function getCategoriaId()
  257.     {
  258.         return $this->categoria;
  259.     }
  260.  
  261.     /**
  262.      * Set marca
  263.      *
  264.      * @param integer $marcaId
  265.      */
  266.     public function setMarcaId(\BestSup\ArticuloBundle\Entity\Marca $marcaId)
  267.     {
  268.         $this->marca = $marcaId;
  269.     }
  270.  
  271.     /**
  272.      * Get marca
  273.      *
  274.      * @return integer
  275.      */
  276.     public function getMarcaId()
  277.     {
  278.         return $this->marca;
  279.     }
  280. }