ObjetivoPlanPatria.php 7.01 KB
<?php

namespace UBV\SurUbvBundle\Entity;

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

/**
 * UBV\SurUbvBundle\Entity\ObjetivoPlanPatria
 *
 * @ORM\Entity(repositoryClass="UBV\SurUbvBundle\Entity\ObjetivoPlanPatriaRepository")
 * @ORM\Table(name="objetivo_plan_patria", indexes={@ORM\Index(name="fk_objetivo_plan_patria_objetivo_nivel1_idx", columns={"objetivo_nivel_id"}), @ORM\Index(name="fk_objetivo_plan_patria_objetivo_plan_patria1_idx", columns={"dependencia_id"})}, uniqueConstraints={@ORM\UniqueConstraint(name="id_objetivo_plan_patria_UNIQUE", columns={"id"})})
 */
class ObjetivoPlanPatria
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\SequenceGenerator(sequenceName="objetivo_plan_patria_id_seq", allocationSize=1, initialValue=1)
     */
    protected $id;

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

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

    /**
     * @ORM\OneToMany(targetEntity="ObjetivoPlanPatria", mappedBy="objetivoPlanPatria")
     * @ORM\JoinColumn(name="id", referencedColumnName="dependencia_id", nullable=false)
     */
    protected $objetivoPlanPatrias;

    /**
     * @ORM\ManyToOne(targetEntity="ObjetivoNivel", inversedBy="objetivoPlanPatrias")
     * @ORM\JoinColumn(name="objetivo_nivel_id", referencedColumnName="id", nullable=false)
     */
    protected $objetivoNivel;

    /**
     * @ORM\ManyToOne(targetEntity="ObjetivoPlanPatria", inversedBy="objetivoPlanPatrias")
     * @ORM\JoinColumn(name="dependencia_id", referencedColumnName="id")
     */
    protected $objetivoPlanPatria;

    /**
     * @ORM\ManyToMany(targetEntity="Proyecto", inversedBy="objetivoPlanPatrias")
     * @ORM\JoinTable(name="proyecto_plan_patria",
     *     joinColumns={@ORM\JoinColumn(name="objetivo_plan_patria_id", referencedColumnName="id", nullable=false)},
     *     inverseJoinColumns={@ORM\JoinColumn(name="proyecto_id", referencedColumnName="id", nullable=false)}
     * )
     */
    protected $proyectos;

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Add ObjetivoPlanPatria entity to collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\ObjetivoPlanPatria $objetivoPlanPatria
     * @return \UBV\SurUbvBundle\Entity\ObjetivoPlanPatria
     */
    public function addObjetivoPlanPatria(ObjetivoPlanPatria $objetivoPlanPatria)
    {
        $this->objetivoPlanPatrias[] = $objetivoPlanPatria;

        return $this;
    }

    /**
     * Remove ObjetivoPlanPatria entity from collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\ObjetivoPlanPatria $objetivoPlanPatria
     * @return \UBV\SurUbvBundle\Entity\ObjetivoPlanPatria
     */
    public function removeObjetivoPlanPatria(ObjetivoPlanPatria $objetivoPlanPatria)
    {
        $this->objetivoPlanPatrias->removeElement($objetivoPlanPatria);

        return $this;
    }

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

    /**
     * Set ObjetivoNivel entity (many to one).
     *
     * @param \UBV\SurUbvBundle\Entity\ObjetivoNivel $objetivoNivel
     * @return \UBV\SurUbvBundle\Entity\ObjetivoPlanPatria
     */
    public function setObjetivoNivel(ObjetivoNivel $objetivoNivel = null)
    {
        $this->objetivoNivel = $objetivoNivel;

        return $this;
    }

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

    /**
     * Set ObjetivoPlanPatria entity (many to one).
     *
     * @param \UBV\SurUbvBundle\Entity\ObjetivoPlanPatria $objetivoPlanPatria
     * @return \UBV\SurUbvBundle\Entity\ObjetivoPlanPatria
     */
    public function setObjetivoPlanPatria(ObjetivoPlanPatria $objetivoPlanPatria = null)
    {
        $this->objetivoPlanPatria = $objetivoPlanPatria;

        return $this;
    }

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

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

        return $this;
    }

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

        return $this;
    }

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

    public function __sleep()
    {
        return array('id', 'indice_objetivo', 'descripcion', 'objetivo_nivel_id', 'dependencia_id');
    }
   
    public function getObjePlanPatria()
         
    {
        
        return $this->indice_objetivo . " " . $this->objetivoPlanPatria;
    }


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