Institucion.php 4.59 KB
<?php

namespace UBV\SurUbvBundle\Entity;

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

/**
 * UBV\SurUbvBundle\Entity\Institucion
 *
 * @ORM\Entity(repositoryClass="UBV\SurUbvBundle\Entity\InstitucionRepository")
 * @ORM\Table(name="institucion", indexes={@ORM\Index(name="fk_institucion_pais1_idx", columns={"pais_id"}), @ORM\Index(name="fk_institucion_institucion_tipo1_idx", columns={"institucion_tipo_id"})}, uniqueConstraints={@ORM\UniqueConstraint(name="id_institucion_UNIQUE", columns={"id"})})
 */
class Institucion
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\SequenceGenerator(sequenceName="institucion_id_seq", allocationSize=1, initialValue=1)
     */
    protected $id;

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

    /**
     * @ORM\OneToMany(targetEntity="AporteInstitucion", mappedBy="institucion")
     * @ORM\JoinColumn(name="id", referencedColumnName="institucion_id", nullable=false)
     */
    protected $aporteInstitucions;

    /**
     * @ORM\ManyToOne(targetEntity="Pais", inversedBy="institucions")
     * @ORM\JoinColumn(name="pais_id", referencedColumnName="id", nullable=false)
     */
    protected $pais;

    /**
     * @ORM\ManyToOne(targetEntity="InstitucionTipo", inversedBy="institucions")
     * @ORM\JoinColumn(name="institucion_tipo_id", referencedColumnName="id", nullable=false)
     */
    protected $institucionTipo;

    

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

    /**
     * Set the value of id.
     *
     * @param integer $id
     * @return \UBV\SurUbvBundle\Entity\Institucion
     */
    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\Institucion
     */
    public function setDescripcion($descripcion)
    {
        $this->descripcion = $descripcion;

        return $this;
    }

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

    /**
     * Add AporteInstitucion entity to collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\AporteInstitucion $aporteInstitucion
     * @return \UBV\SurUbvBundle\Entity\Institucion
     */
    public function addAporteInstitucion(AporteInstitucion $aporteInstitucion)
    {
        $this->aporteInstitucions[] = $aporteInstitucion;

        return $this;
    }

    /**
     * Remove AporteInstitucion entity from collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\AporteInstitucion $aporteInstitucion
     * @return \UBV\SurUbvBundle\Entity\Institucion
     */
    public function removeAporteInstitucion(AporteInstitucion $aporteInstitucion)
    {
        $this->aporteInstitucions->removeElement($aporteInstitucion);

        return $this;
    }

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

    /**
     * Set Pais entity (many to one).
     *
     * @param \UBV\SurUbvBundle\Entity\Pais $pais
     * @return \UBV\SurUbvBundle\Entity\Institucion
     */
    public function setPais(Pais $pais = null)
    {
        $this->pais = $pais;

        return $this;
    }

    /**
     * Get Pais entity (many to one).
     *
     * @return \UBV\SurUbvBundle\Entity\Pais
     */
    public function getPais()
    {
        return $this->pais;
    }

    /**
     * Set InstitucionTipo entity (many to one).
     *
     * @param \UBV\SurUbvBundle\Entity\InstitucionTipo $institucionTipo
     * @return \UBV\SurUbvBundle\Entity\Institucion
     */
    public function setInstitucionTipo(InstitucionTipo $institucionTipo = null)
    {
        $this->institucionTipo = $institucionTipo;

        return $this;
    }

    /**
     * Get InstitucionTipo entity (many to one).
     *
     * @return \UBV\SurUbvBundle\Entity\InstitucionTipo
     */
    public function getInstitucionTipo()
    {
        return $this->institucionTipo;
    }

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

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