id; } /** * Set descripcion * * @param string $descripcion * * @return estado */ public function setDescripcion($descripcion) { $this->descripcion = $descripcion; return $this; } /** * Get descripcion * * @return string */ public function getDescripcion() { return $this->descripcion; } /** * Set codigo * * @param integer $codigo * * @return estado */ public function setCodigo($codigo) { $this->codigo = $codigo; return $this; } /** * Get codigo * * @return int */ public function getCodigo() { return $this->codigo; } public function __toString(){ return $this->getDescripcion(); } /** * @ORM\OneToMany(targetEntity="estado", mappedBy="estado", cascade={"persist", "remove"}) * @Assert\Valid() */ protected $municipio; /** * Constructor */ public function __construct() { $this->municipio = new \Doctrine\Common\Collections\ArrayCollection(); } public function setMunicipio(\Doctrine\Common\Collections\Collection $municipio) { $this->municipio = $municipio; foreach ($municipio as $municipio) { $municipio->setEstado($this); } } } class Municipio { /** * @var string $descripcion * * @ORM\Column(name="descripcion", type="string", length=255) * @Assert\NotBlank() */ protected $descripcion; /** * @var string $codigo * * @ORM\Column(name="codigo", type="string", length=255) * @Assert\NotBlank() */ protected $codigo; /** * @ORM\ManyToOne(targetEntity="estado", inversedBy="municipio") * @ORM\JoinColumn(name="estado_id", referencedColumnName="id") */ private $estado; }