src/Entity/Sales/Profile/TopPlacement.php line 22

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by simpson <simpsonwork@gmail.com>
  4.  * Date: 2019-04-25
  5.  * Time: 12:01
  6.  */
  7. namespace App\Entity\Sales\Profile;
  8. use App\Entity\Location\City;
  9. use App\Entity\Profile\Profile;
  10. use App\Entity\Sales\PaidPlacementPrice;
  11. use App\Repository\ProfileTopPlacementRepository;
  12. use Doctrine\ORM\Mapping as ORM;
  13. /**
  14.  * Топовое размещение анкеты
  15.  * В одном городе в топе может быть только одна анкета в одно и то же время.
  16.  */
  17. #[ORM\Table(name'profile_top_placements')]
  18. #[ORM\Entity(repositoryClassProfileTopPlacementRepository::class)]
  19. class TopPlacement
  20. {
  21.     #[ORM\Id]
  22.     #[ORM\Column(name'id'type'integer')]
  23.     #[ORM\GeneratedValue(strategy'AUTO')]
  24.     protected int $id;
  25.     #[ORM\JoinColumn(name'city_id'referencedColumnName'id')]
  26.     #[ORM\ManyToOne(targetEntityCity::class)]
  27.     protected City $city;
  28.     #[ORM\JoinColumn(name'profile_id'referencedColumnName'id')]
  29.     #[ORM\ManyToOne(targetEntityProfile::class, inversedBy'topPlacements')]
  30.     protected Profile $profile;
  31.     /**
  32.      * Время начала размещения в топе
  33.      */
  34.     #[ORM\Column(name'placed_at'type'datetimetz_immutable')]
  35.     protected \DateTimeImmutable $placedAt;
  36.     /**
  37.      * Время окончания размещения в топе
  38.      */
  39.     #[ORM\Column(name'expires_at'type'datetimetz_immutable')]
  40.     protected \DateTimeImmutable $expiresAt;
  41.     /**
  42.      * Цена, по которой было размещено (для продления по этой же цене)
  43.      */
  44.     #[ORM\JoinColumn(name'placement_price_id'referencedColumnName'id'nullabletrue)]
  45.     #[ORM\ManyToOne(targetEntityPaidPlacementPrice::class)]
  46.     private ?PaidPlacementPrice $placementPrice;
  47.     public function __construct(City $cityProfile $profilePaidPlacementPrice $paidPlacementPrice\DateTimeImmutable $placedAt\DateTimeImmutable $expiresAt)
  48.     {
  49.         $this->city $city;
  50.         $this->profile $profile;
  51.         $this->placedAt $placedAt;
  52.         $this->expiresAt $expiresAt;
  53.         $this->placementPrice $paidPlacementPrice;
  54.     }
  55.     public function getPlacementPrice(): PaidPlacementPrice
  56.     {
  57.         return $this->placementPrice;
  58.     }
  59.     public function getProfile(): Profile
  60.     {
  61.         return $this->profile;
  62.     }
  63.     public function getPlacedAt(): \DateTimeImmutable
  64.     {
  65.         return $this->placedAt;
  66.     }
  67.     public function getExpiresAt(): \DateTimeImmutable
  68.     {
  69.         return $this->expiresAt;
  70.     }
  71. }