src/Entity/Sales/Profile/Ctr.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Sales\Profile;
  3. use App\Entity\Profile\Profile;
  4. use App\Repository\ProfileCtrRepository;
  5. use Carbon\CarbonImmutable;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\ORM\Mapping\Index;
  8. use Doctrine\ORM\Mapping\UniqueConstraint;
  9. #[ORM\Table(name'profile_ctr')]
  10. #[Index(name'idx_date'columns: ['date'])]
  11. #[UniqueConstraint(name'uniq_profile_date'columns: ['profile_id''date'])]
  12. #[ORM\Entity(repositoryClassProfileCtrRepository::class)]
  13. class Ctr
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\Column(name'id'type'integer')]
  17.     #[ORM\GeneratedValue(strategy'AUTO')]
  18.     protected int $id;
  19.     #[ORM\JoinColumn(name'profile_id'referencedColumnName'id')]
  20.     #[ORM\ManyToOne(targetEntityProfile::class)] // //, inversedBy="ctr"
  21.     private Profile $profile;
  22.     #[ORM\Column(type'date')]
  23.     protected \DateTimeInterface $date;
  24.     #[ORM\Column(type'smallint'options: ['default' => 0])]
  25.     protected int $shows;
  26.     #[ORM\Column(type'smallint'options: ['default' => 0])]
  27.     protected int $visits;
  28.     public function __construct(Profile $profileint $shows 0int $visits 0)
  29.     {
  30.         $this->profile $profile;
  31.         $this->shows $shows;
  32.         $this->visits $visits;
  33.         $this->date CarbonImmutable::now();
  34.     }
  35.     public function getProfile(): Profile
  36.     {
  37.         return $this->profile;
  38.     }
  39.     public function setProfile(Profile $profile): void
  40.     {
  41.         $this->profile $profile;
  42.     }
  43. }