src/Entity/Tutoring/Trashspayline.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Tutoring;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Entity\Tutoring\Spayline;
  5. use App\Repository\Tutoring\SpaylineRepository;
  6. use App\Entity\Tutoring\Owe;
  7. use App\Entity\Tutoring\Trashspayment;
  8. use App\Traits\Actions;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Entity(repositoryClassTrashspaylineRepository::class)]
  11. #[ORM\Table(name'hs_tc_training_trashspayline')]
  12. #[ApiResource]
  13. class Trashspayline
  14. {
  15.     use Actions;
  16.     #[ORM\ManyToOne(targetEntityTrashspayment::class, inversedBy"items")]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private Trashspayment $payment;
  19.     #[ORM\Column]
  20.     private ?int $oweId=null;
  21.     #[ORM\Column(name"amount"type"float")]
  22.     private float $amount;
  23.     public function __construct(Spayline $spayline)
  24.     {
  25.         $this->oweId $spayline->getOwe()->getId();
  26.         $this->amount $spayline->getAmount();
  27.         $this->published=$spayline->isPublished();
  28.     }
  29.     /**
  30.      * @return Trashspayment
  31.      */
  32.     public function getPayment(): ?Trashspayment
  33.     {
  34.         return $this->payment;
  35.     }
  36.     /**
  37.      * @param Trashspayment $payment
  38.      */
  39.     public function setPayment(?Trashspayment $payment): Trashspayline
  40.     {
  41.         $this->payment $payment;
  42.         return $this;
  43.     }
  44.     public function getOweId(): ?int
  45.     {
  46.         return $this->oweId;
  47.     }
  48.     public function setOweId(?int $oweId): void
  49.     {
  50.         $this->oweId $oweId;
  51.     }
  52.     /**
  53.      * Set amount
  54.      *
  55.      * @param float $amount
  56.      *
  57.      * @return Trashspayline
  58.      */
  59.     public function setAmount($amount)
  60.     {
  61.         $this->amount $amount;
  62.         return $this;
  63.     }
  64.     /**
  65.      * Get amount
  66.      *
  67.      * @return float
  68.      */
  69.     public function getAmount()
  70.     {
  71.         return $this->amount;
  72.     }
  73.     public function restore(Owe $owe) : Spayline
  74.     {
  75.         $spayline = new Spayline();
  76.         $spayline->setOwe($owe);
  77.         $spayline->setAmount($this->getAmount());
  78.         $spayline->setPublished($this->isPublished());
  79.         return $spayline;
  80.     }
  81. }