Comunidad.php 3.84 KB
<?php

namespace UBV\SurUbvBundle\Entity;

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

/**
 * UBV\SurUbvBundle\Entity\Comunidad
 *
 * @ORM\Entity(repositoryClass="UBV\SurUbvBundle\Entity\ComunidadRepository")
 * @ORM\Table(name="comunidad", indexes={@ORM\Index(name="fk_comunidad_comunidad_tipo1_idx", columns={"comunidad_tipo_id"})}, uniqueConstraints={@ORM\UniqueConstraint(name="id_comunidad_UNIQUE", columns={"id"})})
 */
class Comunidad
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\SequenceGenerator(sequenceName="comunidad_id_seq", allocationSize=1, initialValue=1)
     */
    protected $id;

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

    /**
     * @ORM\OneToMany(targetEntity="ProyectoComunidad", mappedBy="comunidad")
     * @ORM\JoinColumn(name="id", referencedColumnName="comunidad_id", nullable=false)
     */
    protected $proyectoComunidads;

    /**
     * @ORM\ManyToOne(targetEntity="ComunidadTipo", inversedBy="comunidads")
     * @ORM\JoinColumn(name="comunidad_tipo_id", referencedColumnName="id", nullable=false)
     */
    protected $comunidadTipo;

     

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

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

        return $this;
    }

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

    /**
     * Add ProyectoComunidad entity to collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\ProyectoComunidad $proyectoComunidad
     * @return \UBV\SurUbvBundle\Entity\Comunidad
     */
    public function addProyectoComunidad(ProyectoComunidad $proyectoComunidad)
    {
        $this->proyectoComunidads[] = $proyectoComunidad;

        return $this;
    }

    /**
     * Remove ProyectoComunidad entity from collection (one to many).
     *
     * @param \UBV\SurUbvBundle\Entity\ProyectoComunidad $proyectoComunidad
     * @return \UBV\SurUbvBundle\Entity\Comunidad
     */
    public function removeProyectoComunidad(ProyectoComunidad $proyectoComunidad)
    {
        $this->proyectoComunidads->removeElement($proyectoComunidad);

        return $this;
    }

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

    /**
     * Set ComunidadTipo entity (many to one).
     *
     * @param \UBV\SurUbvBundle\Entity\ComunidadTipo $comunidadTipo
     * @return \UBV\SurUbvBundle\Entity\Comunidad
     */
    public function setComunidadTipo(ComunidadTipo $comunidadTipo = null)
    {
        $this->comunidadTipo = $comunidadTipo;

        return $this;
    }

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

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

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


}