src/Entity/Account/Avatar.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Account;
  3. use App\Entity\User;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Table(name: 'user_media_files')]
  6. #[ORM\Entity]
  7. class Avatar
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\Column(name: 'id', type: 'integer')]
  11.     #[ORM\GeneratedValue(strategy: 'AUTO')]
  12.     protected int $id;
  13.     #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
  14.     #[ORM\OneToOne(targetEntity: User::class, inversedBy: 'avatar')]
  15.     protected User $user;
  16.     #[ORM\Column(name: 'path', type: 'string', length: 128)]
  17.     protected string $path;
  18.     public function __construct(User $user, string $path)
  19.     {
  20.         $this->user = $user;
  21.         $this->path = $path;
  22.     }
  23.     public function getId(): int
  24.     {
  25.         return $this->id;
  26.     }
  27.     
  28.     public function getPath(): string
  29.     {
  30.         return $this->path;
  31.     }
  32. }