src/Entity/Telegram/AgentPublicBot/BotPlan.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Telegram\AgentPublicBot;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\VPN\Service\Plan;
  5. use App\Repository\Telegram\AgentPublicBot\BotPlanRepository;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  9. #[ORM\Entity(repositoryClassBotPlanRepository::class)]
  10. class BotPlan extends BaseEntity
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\Column(type'guid'uniquetrue)]
  14.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  15.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  16.     private ?string $id null;
  17.     #[ORM\ManyToOne(inversedBy'botPlans')]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?Bot $bot null;
  20.     #[ORM\Column(typeTypes::BIGINT)]
  21.     private ?string $price null;
  22.     #[ORM\ManyToOne(inversedBy'botPlans')]
  23.     private ?Plan $plan null;
  24.     public function getId(): ?string
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getBot(): ?Bot
  29.     {
  30.         return $this->bot;
  31.     }
  32.     public function setBot(?Bot $bot): static
  33.     {
  34.         $this->bot $bot;
  35.         return $this;
  36.     }
  37.     public function getPrice(): ?string
  38.     {
  39.         return $this->price;
  40.     }
  41.     public function setPrice(string $price): static
  42.     {
  43.         $this->price $price;
  44.         return $this;
  45.     }
  46.     public function formatSizeUnits($bytes): string
  47.     {
  48.         if ($bytes >= 1073741824) {
  49.             $bytes number_format($bytes 10737418242) . ' GB';
  50.         } elseif ($bytes >= 1048576) {
  51.             $bytes number_format($bytes 10485762) . ' MB';
  52.         } elseif ($bytes >= 1024) {
  53.             $bytes number_format($bytes 10242) . ' KB';
  54.         } elseif ($bytes 1) {
  55.             $bytes $bytes ' bytes';
  56.         } elseif ($bytes == 1) {
  57.             $bytes $bytes ' byte';
  58.         } else {
  59.             $bytes '0 bytes';
  60.         }
  61.         return $bytes;
  62.     }
  63.     public function getPlan(): ?Plan
  64.     {
  65.         return $this->plan;
  66.     }
  67.     public function setPlan(?Plan $plan): static
  68.     {
  69.         $this->plan $plan;
  70.         return $this;
  71.     }
  72. }