Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/10/2014, 18:05
sxwark
 
Fecha de Ingreso: agosto-2013
Ubicación: Oyón/Alava
Mensajes: 23
Antigüedad: 10 años, 9 meses
Puntos: 0
Respuesta: Formulario para insertar datos en entidades con relacion M:N

Pongo aqui otra entidad porque no me permite introducir más caracteres

Entidad producto:

Código PHP:
<?php

namespace WolfrcProductosBundleEntity
;

use 
DoctrineORMMapping as ORM;

/**
 * Productos
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Wolfrc\ProductosBundle\Entity\ProductosRepository")
 */
class Productos
{
    
/**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    
private $id;
  
    
    
/**
     *
     * @ORM\ManyToMany(targetEntity="Wolfrc\ProductosBundle\Entity\Categoria", mappedBy="productos")
     */
    
private $categorias;
    
    
/**
     *
     * @ORM\OneToMany(targetEntity="Wolfrc\OfertaBundle\Entity\Oferta", mappedBy="code")
     */
    
private $oferta;
    
    
    
/**
     * @ORM\ManyToMany(targetEntity="Wolfrc\OptionsBundle\Entity\Ficheros", mappedBy="producto")
     */
    
private $imagenes;
    
    
/**
     *
     * @ORM\OneToMany(targetEntity="Wolfrc\FacturasBundle\Entity\LineaFactura", mappedBy="idProducto")
     */
    
private $lineaFactura;
    
    
    
/**
     *
     * @ORM\OneToMany(targetEntity="Wolfrc\TiendaBundle\Entity\ArticulosPedidoProveedor", mappedBy="productoCode")
     */
    
private $producto;

    public function 
__construct() {
        
$this->categorias = new DoctrineCommonCollectionsArrayCollection();
        
$this->oferta = new DoctrineCommonCollectionsArrayCollection();
        
$this->imagenes = new DoctrineCommonCollectionsArrayCollection();
        
$this->lineaFactura = new DoctrineCommonCollectionsArrayCollection(); 
        
$this->producto = new DoctrineCommonCollectionsArrayCollection(); 
    }
    
    public function 
__toString() {
        return 
$this->getNombre();
    }


    
/**
     * Get id
     *
     * @return integer 
     */
    
public function getId()
    {
        return 
$this->id;
    }

   
    
/**
     * Add categorias
     *
     * @param \Wolfrc\ProductosBundle\Entity\Categoria $categorias
     * @return Productos
     */
    
public function addCategoria(WolfrcProductosBundleEntityCategoria $categorias)
    {
        
$this->categorias[] = $categorias;

        return 
$this;
    }

    
/**
     * Remove categorias
     *
     * @param \Wolfrc\ProductosBundle\Entity\Categoria $categorias
     */
    
public function removeCategoria(WolfrcProductosBundleEntityCategoria $categorias)
    {
        
$this->categorias->removeElement($categorias);
    }

    
/**
     * Get categorias
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    
public function getCategorias()
    {
        return 
$this->categorias;
    }

    
/**
     * Add oferta
     *
     * @param \Wolfrc\OfertaBundle\Entity\Oferta $oferta
     * @return Productos
     */
    
public function addOfertum(WolfrcOfertaBundleEntityOferta $oferta)
    {
        
$this->oferta[] = $oferta;

        return 
$this;
    }

    
/**
     * Remove oferta
     *
     * @param \Wolfrc\OfertaBundle\Entity\Oferta $oferta
     */
    
public function removeOfertum(WolfrcOfertaBundleEntityOferta $oferta)
    {
        
$this->oferta->removeElement($oferta);
    }

    
/**
     * Get oferta
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    
public function getOferta()
    {
        return 
$this->oferta;
    }

    
/**
     * Add lineaFactura
     *
     * @param \Wolfrc\FacturasBundle\Entity\LineaFactura $lineaFactura
     * @return Productos
     */
    
public function addLineaFactura(WolfrcFacturasBundleEntityLineaFactura $lineaFactura)
    {
        
$this->lineaFactura[] = $lineaFactura;

        return 
$this;
    }

    
/**
     * Remove lineaFactura
     *
     * @param \Wolfrc\FacturasBundle\Entity\LineaFactura $lineaFactura
     */
    
public function removeLineaFactura(WolfrcFacturasBundleEntityLineaFactura $lineaFactura)
    {
        
$this->lineaFactura->removeElement($lineaFactura);
    }

    
/**
     * Get lineaFactura
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    
public function getLineaFactura()
    {
        return 
$this->lineaFactura;
    }

    
/**
     * Add producto
     *
     * @param \Wolfrc\TiendaBundle\Entity\ArticulosPedidoProveedor $producto
     * @return Productos
     */
    
public function addProducto(WolfrcTiendaBundleEntityArticulosPedidoProveedor $producto)
    {
        
$this->producto[] = $producto;

        return 
$this;
    }

    
/**
     * Remove producto
     *
     * @param \Wolfrc\TiendaBundle\Entity\ArticulosPedidoProveedor $producto
     */
    
public function removeProducto(WolfrcTiendaBundleEntityArticulosPedidoProveedor $producto)
    {
        
$this->producto->removeElement($producto);
    }

    
/**
     * Get producto
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    
public function getProducto()
    {
        return 
$this->producto;
    }

    
/**
     * Add imagenes
     *
     * @param \Wolfrc\OptionsBundle\Entity\Ficheros $imagenes
     * @return Productos
     */
    
public function addImagene(WolfrcOptionsBundleEntityFicheros $imagenes)
    {
        
$this->imagenes[] = $imagenes;

        return 
$this;
    }

    
/**
     * Remove imagenes
     *
     * @param \Wolfrc\OptionsBundle\Entity\Ficheros $imagenes
     */
    
public function removeImagene(WolfrcOptionsBundleEntityFicheros $imagenes)
    {
        
$this->imagenes->removeElement($imagenes);
    }

    
/**
     * Get imagenes
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    
public function getImagenes()
    {
        return 
$this->imagenes;
    }
}