You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.4 KiB
73 lines
1.4 KiB
<?php
|
|
namespace App\Entity;
|
|
|
|
use ApiPlatform\Metadata\ApiProperty;
|
|
use Doctrine\ORM\Mapping\Column;
|
|
use Doctrine\ORM\Mapping\Entity;
|
|
use Doctrine\ORM\Mapping\JoinColumn;
|
|
use Doctrine\ORM\Mapping\OneToOne;
|
|
use Doctrine\ORM\Mapping\Table;
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
|
#[Entity(repositoryClass: "App\Repository\UserRepository")]
|
|
#[Table(name: '`user`')]
|
|
class User extends Thing implements UserInterface
|
|
{
|
|
|
|
// from discord
|
|
#[ApiProperty(writable: true)]
|
|
#[Column(type: 'string')]
|
|
public string $authName;
|
|
|
|
#[OneToOne(inversedBy: 'dojo')]
|
|
#[JoinColumn(onDelete: 'cascade', nullable: true)]
|
|
public ?Dojo $dojo;
|
|
|
|
// anonymous data used for the client
|
|
#[ApiProperty()]
|
|
#[Column(type: 'json')]
|
|
public mixed $properties;
|
|
|
|
public function getProperties(): array
|
|
{
|
|
return $this->properties;
|
|
}
|
|
|
|
public function setProperties(array $properties): static
|
|
{
|
|
$this->properties = $properties;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDojo(): ?Dojo
|
|
{
|
|
return $this->dojo;
|
|
}
|
|
|
|
public function setDojo(?Dojo $dojo): static
|
|
{
|
|
$this->dojo = $dojo;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUserIdentifier(): string
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function eraseCredentials(): void
|
|
{
|
|
return;
|
|
}
|
|
|
|
public function getRoles(): array
|
|
{
|
|
return [
|
|
"ROLE_USER"
|
|
];
|
|
}
|
|
}
|
|
|