src/Entity/Sales/PlacementHiding.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Sales;
  3. use App\Repository\PlacementHidingRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\ORM\Mapping\Index;
  6. #[ORM\Table(name: 'placement_hidings')]
  7. #[Index(name: 'idx_entity_type', columns: ['entity_type'])]
  8. #[Index(name: 'idx_profile_entity_type', columns: ['profile_id', 'entity_type'])]
  9. #[Index(name: 'idx_saloon_entity_type', columns: ['saloon_id', 'entity_type'])]
  10. #[ORM\Entity(repositoryClass: PlacementHidingRepository::class)]
  11. #[ORM\InheritanceType('SINGLE_TABLE')]
  12. #[ORM\DiscriminatorColumn(name: 'entity_type', type: 'string', length: 12)]
  13. #[ORM\DiscriminatorMap(['profile' => Profile\PlacementHiding::class, 'saloon' => Saloon\PlacementHiding::class])]
  14. abstract class PlacementHiding
  15. {
  16.     #[ORM\Id]
  17.     #[ORM\Column(name: 'id', type: 'integer')]
  18.     #[ORM\GeneratedValue(strategy: 'AUTO')]
  19.     protected int $id;
  20.     /**
  21.      * Время добавление опции "спрятать"
  22.      */
  23.     #[ORM\Column(name: 'placed_at', type: 'datetimetz_immutable')]
  24.     protected \DateTimeImmutable $placedAt;
  25.     /**
  26.      * Время следующего списания за скрытие в списке
  27.      */
  28.     #[ORM\Column(name: 'placed_until', type: 'datetimetz_immutable')]
  29.     protected \DateTimeImmutable $placedUntil;
  30.     protected function __construct(\DateTimeImmutable $placedAt, \DateTimeImmutable $placedUntil)
  31.     {
  32.         $this->placedAt = $placedAt;
  33.         $this->placedUntil = $placedUntil;
  34.     }
  35.     public function getPlacedAt(): \DateTimeImmutable
  36.     {
  37.         return $this->placedAt;
  38.     }
  39.     public function getPlacedUntil(): \DateTimeImmutable
  40.     {
  41.         return $this->placedUntil;
  42.     }
  43.     
  44.     public function prolong(\DateTimeImmutable $placedUntil): void
  45.     {
  46.         $this->placedUntil = $placedUntil;
  47.     }
  48. }