|
|
|
|
@ -23,34 +23,35 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|
|
|
|
#[MongoDB\Field(type: 'string')]
|
|
|
|
|
#[Assert\NotBlank]
|
|
|
|
|
#[Assert\Email]
|
|
|
|
|
protected ?string $email = null;
|
|
|
|
|
protected string $email;
|
|
|
|
|
|
|
|
|
|
#[MongoDB\Field(type: 'string')]
|
|
|
|
|
#[Assert\NotBlank]
|
|
|
|
|
protected ?string $password = null;
|
|
|
|
|
private string $password;
|
|
|
|
|
|
|
|
|
|
#[MongoDB\Field(type: 'collection')]
|
|
|
|
|
private array $roles = ['ROLE_USER'];
|
|
|
|
|
|
|
|
|
|
#[MongoDB\ReferenceMany(targetDocument: Chart::class, mappedBy: "user")]
|
|
|
|
|
protected $charts;
|
|
|
|
|
//#[MongoDB\ReferenceMany(targetDocument: Chart::class, mappedBy: "user")]
|
|
|
|
|
//protected $charts;
|
|
|
|
|
|
|
|
|
|
public function getId(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getEmail(): ?string
|
|
|
|
|
public function getEmail(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->email;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setEmail(?string $email): void
|
|
|
|
|
public function setEmail(string $email): self
|
|
|
|
|
{
|
|
|
|
|
$this->email = $email;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getPassword(): ?string
|
|
|
|
|
public function getPassword(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->password;
|
|
|
|
|
}
|
|
|
|
|
@ -65,26 +66,26 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|
|
|
|
/**
|
|
|
|
|
* @return Collection<int, Chart>
|
|
|
|
|
*/
|
|
|
|
|
public function getCharts(): Collection
|
|
|
|
|
{
|
|
|
|
|
return $this->charts;
|
|
|
|
|
}
|
|
|
|
|
//public function getCharts(): Collection
|
|
|
|
|
//{
|
|
|
|
|
// return $this->charts;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds a chart to the user.
|
|
|
|
|
*
|
|
|
|
|
* @param Chart $chart The chart to add
|
|
|
|
|
*/
|
|
|
|
|
public function addChart(Chart $chart): void
|
|
|
|
|
{
|
|
|
|
|
//public function addChart(Chart $chart): void
|
|
|
|
|
//{
|
|
|
|
|
// Check if the chart already exists in the collection
|
|
|
|
|
if (!$this->charts->contains($chart)) {
|
|
|
|
|
// if (!$this->charts->contains($chart)) {
|
|
|
|
|
// Add the chart to the collection
|
|
|
|
|
$this->charts->add($chart);
|
|
|
|
|
// $this->charts->add($chart);
|
|
|
|
|
// Set the user reference in the chart entity
|
|
|
|
|
$chart->setUser($this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// $chart->setUser($this);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public function getRoles(): array
|
|
|
|
|
{
|
|
|
|
|
@ -111,7 +112,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|
|
|
|
|
|
|
|
|
public function getUserIdentifier(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->email;
|
|
|
|
|
return (string) $this->email;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|