src/Entity/Device/Device.php line 28
<?php/** This file is part of the Pellipop project.** (c) Mobizel** For the full copyright and license information, please view the LICENSE* file that was distributed with this source code.*/declare(strict_types=1);namespace App\Entity\Device;use ApiPlatform\Metadata\ApiProperty;use App\Entity\Customer\Customer;use App\Entity\IdentifiableTrait;use App\Repository\Device\DeviceRepository;use Doctrine\ORM\Mapping as ORM;use Sylius\Component\Resource\Model\ResourceInterface;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: DeviceRepository::class)]#[ORM\Table(name: 'app_device')]#[UniqueEntity(fields: ['token'])]class Device implements ResourceInterface{use IdentifiableTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]#[ApiProperty(identifier: false)]protected ?int $id = null;#[ORM\Column(type: 'string', unique: true)]#[Assert\NotBlank]#[ApiProperty(identifier: true)]private string $token;#[ORM\ManyToOne(targetEntity: Customer::class, inversedBy: 'devices')]#[ORM\JoinColumn(nullable: true)]private Customer $customer;public function getToken(): string{return $this->token;}public function setToken(string $token): void{$this->token = $token;}public function getCustomer(): ?Customer{return $this->customer;}public function setCustomer(?Customer $customer): void{$this->customer = $customer;}}