src/Entity/Telefono.php line 35
<?phpnamespace App\Entity;use Ramsey\Uuid\Uuid;use App\Trait\UuidTrait;use ApiPlatform\Metadata\Get;use ApiPlatform\Metadata\Put;use ApiPlatform\Metadata\Post;use ApiPlatform\Metadata\Patch;use ApiPlatform\Metadata\Delete;use Doctrine\ORM\Mapping as ORM;use ApiPlatform\Metadata\ApiResource;use App\Repository\TelefonoRepository;use ApiPlatform\Metadata\GetCollection;use Ramsey\Uuid\Doctrine\UuidGenerator;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: TelefonoRepository::class)]#[ApiResource(operations: [new Get(uriTemplate: 'telefonos/'),new Post(validationContext: ['groups' => ['Default', 'telefono:create']], denormalizationContext: ['groups' => ['telefono:create']], uriTemplate: 'telefonoes'),new GetCollection(uriTemplate: 'telefonoes'),new Put(denormalizationContext: ['groups' => ['telefono:update']],),new Patch(denormalizationContext: ['groups' => ['telefono:update']],),new Delete(),],normalizationContext: ['groups' => ['telefono:read', 'uuid']],)]class Telefono{use UuidTrait;#[Assert\NotBlank(groups: ['telefono:create'])]#[Groups(['telefono:read', 'telefono:create', 'telefono:update','user:read', 'user:create', 'user:update','empresa:read', 'empresa:create', 'empresa:update'])]#[ORM\Column(length: 255)]private ?string $numero = null;#[Groups(['telefono:read', 'telefono:create', 'telefono:update'])]#[ORM\ManyToOne(inversedBy: 'telefonos')]private ?User $user = null;#[Groups(['telefono:read', 'telefono:create', 'telefono:update','user:read', 'user:create', 'user:update','empresa:read', 'empresa:create', 'empresa:update'])]#[ORM\Column]private ?bool $isPrincipal = null;#[Groups(['telefono:read', 'telefono:create', 'telefono:update'])]#[ORM\ManyToOne(inversedBy: 'telefonos')]private ?Empresa $empresa = null;public function __construct(){$this->uuid = Uuid::uuid4()->toString();}public function getNumero(): ?string{return $this->numero;}public function setNumero(string $numero): self{$this->numero = $numero;return $this;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function isIsPrincipal(): ?bool{return $this->isPrincipal;}public function setIsPrincipal(bool $isPrincipal): self{$this->isPrincipal = $isPrincipal;return $this;}public function getEmpresa(): ?Empresa{return $this->empresa;}public function setEmpresa(?Empresa $empresa): self{$this->empresa = $empresa;return $this;}}