Ambito.php 2.73 KB
<?php

namespace UBV\SurUbvBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * UBV\SurUbvBundle\Entity\Ambito
 *
 * @ORM\Entity(repositoryClass="UBV\SurUbvBundle\Entity\AmbitoRepository")
 * @ORM\Table(name="ambito", uniqueConstraints={@ORM\UniqueConstraint(name="id_ambito_UNIQUE", columns={"id"})})
 */
class Ambito
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\SequenceGenerator(sequenceName="ambito_id_seq", allocationSize=1, initialValue=1)
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=45)
     */
    protected $descripcion;

    /**
     * @ORM\OneToMany(targetEntity="Proyecto", mappedBy="ambito")
     * @ORM\JoinColumn(name="id", referencedColumnName="ambito_id", nullable=false)
     */
    protected $proyectos;

    public function __construct()
    {
        $this->proyectos = new ArrayCollection();
    }

    /**
     * Set the value of id.
     *
     * @param integer $id
     * @return \UBV\SurUbvBundle\Entity\Ambito
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

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

    /**
     * Set the value of descripcion.
     *
     * @param string $descripcion
     * @return \UBV\SurUbvBundle\Entity\Ambito
     */
    public function setDescripcion($descripcion)
    {
        $this->descripcion = $descripcion;

        return $this;
    }

    /**
     * Get the value of descripcion.
     *
     * @return string
     */
    public function getDescripcion()
    {
        return $this->descripcion;
    }

    /**
     * Add Proyecto entity to collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\Proyecto $proyecto
     * @return \UBV\SurUbvBundle\Entity\Ambito
     */
    public function addProyecto(Proyecto $proyecto)
    {
        $this->proyectos[] = $proyecto;

        return $this;
    }

    /**
     * Remove Proyecto entity from collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\Proyecto $proyecto
     * @return \UBV\SurUbvBundle\Entity\Ambito
     */
    public function removeProyecto(Proyecto $proyecto)
    {
        $this->proyectos->removeElement($proyecto);

        return $this;
    }

    /**
     * Get Proyecto entity collection (one to many).
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getProyectos()
    {
        return $this->proyectos;
    }

    public function __sleep()
    {
        return array('id', 'descripcion');
    }

    public function __toString() {
        return $this->descripcion;
    }

}