<?php
namespace App\Entity;
use App\Repository\RegionRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RegionRepository::class)]
class Region
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
//#[ORM\Column(type: 'text', nullable:true, unique: true)]
#[ORM\Column(type: 'string', length: 255, nullable:false, unique: true)]
private $nombre;
#[ORM\Column(type: "integer", nullable: true)]
private ?int $orden = null;
#[ORM\ManyToMany(targetEntity: "App\Entity\User", mappedBy: 'regiones')]
private $usuarios;
public function __construct()
{
$this->usuarios = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(?string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
public function getOrden(): ?int
{
return $this->orden;
}
public function setOrden(int $orden): self
{
$this->orden = $orden;
return $this;
}
public function __toString(){
return $this->getNombre();
}
public function getUsuarios()
{
return $this->usuarios;
}
}