src/Entity/ProjectOrderExpensePositions.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectOrderExpensePositionsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Serializer\Annotation\MaxDepth;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ProjectOrderExpensePositionsRepository::class)
  11.  */
  12. class ProjectOrderExpensePositions
  13. {
  14.     /**
  15.      * ðŸ’¡ðŸ’¡ðŸ’¡ðŸ’¡
  16.      *  project.orders.expense.positions.countable.version
  17.      *  countable sadece exoense list Ã¼zerinde expense ait kac tane position oldugunu anlamak icin lazim!!!
  18.      *  ðŸ’¡ðŸ’¡ðŸ’¡ðŸ’¡
  19.     */
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      * @Groups({
  25.      *      "project.orders.expense.position.base",
  26.      *      "project.orders.expense.positions.countable.version",
  27.      *
  28.      *      "project.orders.expense.minify.version",
  29.      *
  30.      *     "expense.position.core", "expense_position@core"
  31.      * })
  32.      */
  33.     private $id;
  34.     /**
  35.      * @Groups({
  36.      *      "project.orders.expense.position.base",
  37.      *  })
  38.     */
  39.     private $test;
  40.     /**
  41.      * @return mixed
  42.      */
  43.     public function getTest()
  44.     {
  45.         return $this->test;
  46.     }
  47.     /**
  48.      *     "project.orders.expense.position.base",
  49.      * @ORM\ManyToOne(targetEntity=ProjectOrderExpenses::class, inversedBy="projectOrderExpensePositions")
  50.      * @ORM\JoinColumn(onDelete="CASCADE")
  51.      * @Groups({
  52.      *     "project.orders.expense.minify.version",
  53.      *
  54.      *     "expense.position.expense"
  55.      * })
  56.      */
  57.     private $project_order_expense;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity=Material::class, inversedBy="projectOrderExpensePositions")
  60.      * @ORM\JoinColumn(nullable=true)
  61.      * @Groups({
  62.      *     "material.base",
  63.      *
  64.      *     "expense.position.material"
  65.      * })
  66.      */
  67.     private $material;
  68.     /**
  69.      * @ORM\Column(type="integer")
  70.      * @Groups({
  71.      *      "project.orders.expense.position.base",
  72.      *      "project.orders.expense.minify.version",
  73.      *      "project.orders.expense.positions.countable.version",
  74.      *      "expense.position.core", "expense_position@core"
  75.      * })
  76.      */
  77.     private $unit;
  78.     /**
  79.      * @ORM\Column(type="datetime_immutable")
  80.      * @Groups({
  81.      *     "project.orders.expense.position.base",
  82.      *     "expense.position.core", "expense_position@core"
  83.      * })
  84.      */
  85.     private $created_at;
  86.     /**
  87.      * @ORM\Column(type="datetime_immutable", nullable=true)
  88.      * @Groups({
  89.      *     "project.orders.expense.position.base",
  90.      *     "project.orders.expense.minify.version",
  91.      *     "project.orders.expense.positions.countable.version",
  92.      *
  93.      *     "expense.position.core", "expense_position@core"
  94.      * })
  95.      */
  96.     private $delivered_at;
  97.     /**
  98.      * @deprecated use buying price instead
  99.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  100.      * @Groups({
  101.      *     "project.orders.expense.position.base",
  102.      *     "project.orders.expense.minify.version",
  103.      *     "project.orders.expense.positions.countable.version",
  104.      *     "expense.position.core", "expense_position@core"
  105.      * })
  106.      */
  107.     private $amount;
  108.     /**
  109.      * @ORM\Column(type="integer", nullable=true)
  110.      * @Groups({
  111.      *     "project.orders.expense.position.base",
  112.      *     "expense.position.core", "expense_position@core"
  113.      * })
  114.      */
  115.     private $delivered_unit;
  116.     /**
  117.      * @ORM\Column(type="text", nullable=true)
  118.      * @Groups({
  119.      *     "project.orders.expense.position.base",
  120.      *     "project.orders.expense.minify.version",
  121.      *     "expense.position.core", "expense_position@core"
  122.      * })
  123.      *
  124.      */
  125.     private $content;
  126.     /**
  127.      * @ORM\Column(type="boolean", nullable=true)
  128.      * @Groups({
  129.      *     "project.orders.expense.position.base",
  130.      *     "expense.position.core", "expense_position@core"
  131.      * })
  132.      */
  133.     private $completed;
  134.     /**
  135.      * @ORM\Column(type="text", nullable=true)
  136.      * @Groups({
  137.      *     "project.orders.expense.position.base",
  138.      *     "expense.position.core", "expense_position@core"
  139.      * })
  140.      */
  141.     private $comment;
  142.     /**
  143.      * @ORM\Column(type="string", length=255, nullable=true)
  144.      * @Groups({
  145.      *     "project.orders.expense.position.base",
  146.      *     "expense.position.core", "expense_position@core"
  147.      * })
  148.      */
  149.     private $delivered_to;
  150.     /**
  151.      * @MaxDepth(1)
  152.      * @ORM\ManyToOne(targetEntity=ProjectOrders::class, inversedBy="projectOrderExpensePositions")
  153.      * @Groups({
  154.      *     "project.orders.expense.position.base",
  155.      *     "project.order.expense.position.order",
  156.      *
  157.      *     "expense.position.order"
  158.      * })
  159.      */
  160.     private $project_order;
  161.     /**
  162.      * A manipulated or simulated column is used to prevent circular references.
  163.      * It is used for retrieving the necessary information related to an order in order to generate
  164.      * a list of minified expenses for the associated spending
  165.      * @Groups({
  166.      *     "project.orders.expense.minify.version",
  167.      *     })
  168.      */
  169.     private $required_order_details_for_expense_history;
  170.     /**
  171.      * @return mixed
  172.      */
  173.     public function getRequiredOrderDetailsForExpenseHistory(): array
  174.     {
  175.         if($this->getProjectOrder()){
  176.             return [
  177.                 "id" => $this->getProjectOrder()->getId(),
  178.                 "order_nr" => $this->getProjectOrder()->getOrderNr()
  179.             ];
  180.         }
  181.         return null;
  182.     }
  183.     /**
  184.      * @ORM\Column(type="string", length=64, nullable=true)
  185.      * @Groups({
  186.      *     "project.orders.expense.position.base",
  187.      *     "expense.position.core", "expense_position@core"
  188.      * })
  189.      */
  190.     private $an_supplier;
  191.     /**
  192.      * @ORM\ManyToOne(targetEntity=ProjectOrderExpensePositions::class, inversedBy="decomposed_positions", cascade={"persist"})
  193.      * @Groups({
  194.      *     "project.orders.expense.position.base",
  195.      *     "expense.position.core", "expense_position@core"
  196.      * })
  197.      * @ORM\JoinColumn(onDelete="SET NULL")
  198.      */
  199.     private $parent_pos;
  200.     /**
  201.      * @ORM\OneToMany(targetEntity=ProjectOrderExpensePositions::class, mappedBy="parent_pos")
  202.      * @Groups({
  203.      *     "project.orders.expense.position.base",
  204.      *     "expense.position.decomposed"
  205.      * })
  206.      */
  207.     private $decomposed_positions;
  208.     /**
  209.      * @ORM\Column(type="string", length=255, nullable=true)
  210.      * @Groups({
  211.      *     "project.orders.expense.position.base",
  212.      *     "project.orders.expense.minify.version",
  213.      *     "expense.position.core", "expense_position@core"
  214.      * })
  215.      */
  216.     private $file_name;
  217.     /**
  218.      * @ORM\ManyToOne(targetEntity=Stocks::class, inversedBy="projectOrderExpensePositions")
  219.      * @Groups({
  220.      *      "project_orders_expense_position@stock"
  221.      *  })
  222.      */
  223.     private $stock;
  224.     /**
  225.      * @ORM\Column(type="float", nullable=true)
  226.      * @Groups({
  227.      *      "project.orders.expense.position.base",
  228.      *      "project.orders.expense.minify.version",
  229.      *      "project.orders.expense.positions.countable.version",
  230.      *      "expense.position.core", "expense_position@core"
  231.      *  })
  232.      */
  233.     private $buying_price;
  234.     /**
  235.      * @ORM\Column(type="float", nullable=true)
  236.      * @Groups({
  237.      *      "project.orders.expense.position.base",
  238.      *      "project.orders.expense.minify.version",
  239.      *      "project.orders.expense.positions.countable.version",
  240.      *      "expense.position.core", "expense_position@core"
  241.      *  })
  242.      */
  243.     private $sales_price;
  244.     /**
  245.      * @ORM\Column(type="float", nullable=true)
  246.      * @Groups({
  247.      *      "project.orders.expense.position.base",
  248.      *      "project.orders.expense.minify.version",
  249.      *      "project.orders.expense.positions.countable.version",
  250.      *      "expense.position.core", "expense_position@core"
  251.      *  })
  252.      */
  253.     private $sales_margin;
  254.     /**
  255.      * @ORM\OneToOne(targetEntity=PurchaseRequestPositions::class, inversedBy="expense_position", cascade={"persist", "remove"})
  256.      * @ORM\JoinColumn(onDelete="CASCADE")
  257.      * @Groups({
  258.      *        "expense_position@purchse_request_position"
  259.      *    })
  260.      */
  261.     private $purchase_request_position;
  262.     /**
  263.      * @ORM\Column(type="float", nullable=true)
  264.      * @Groups({
  265.      *       "project.orders.expense.position.base",
  266.      *       "project.orders.expense.minify.version",
  267.      *       "project.orders.expense.positions.countable.version",
  268.      *       "expense.position.core", "expense_position@core"
  269.      *   })
  270.      */
  271.     private $delivery_amount;
  272.     public function __construct()
  273.     {
  274.         $this->decomposed_positions = new ArrayCollection();
  275.     }
  276.     public function getId(): ?int
  277.     {
  278.         return $this->id;
  279.     }
  280.     public function getProjectOrderExpense(): ?ProjectOrderExpenses
  281.     {
  282.         return $this->project_order_expense;
  283.     }
  284.     public function setProjectOrderExpense(?ProjectOrderExpenses $project_order_expense): self
  285.     {
  286.         $this->project_order_expense $project_order_expense;
  287.         return $this;
  288.     }
  289.     public function getMaterial(): ?Material
  290.     {
  291.         return $this->material;
  292.     }
  293.     public function setMaterial(?Material $material): self
  294.     {
  295.         $this->material $material;
  296.         return $this;
  297.     }
  298.     public function getUnit(): ?int
  299.     {
  300.         return $this->unit;
  301.     }
  302.     public function setUnit(int $unit): self
  303.     {
  304.         $this->unit $unit;
  305.         return $this;
  306.     }
  307.     public function getCreatedAt(): ?\DateTimeImmutable
  308.     {
  309.         return $this->created_at;
  310.     }
  311.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  312.     {
  313.         $this->created_at $created_at;
  314.         return $this;
  315.     }
  316.     public function getDeliveredAt(): ?\DateTimeImmutable
  317.     {
  318.         return $this->delivered_at;
  319.     }
  320.     public function setDeliveredAt(?\DateTimeImmutable $delivered_at): self
  321.     {
  322.         $this->delivered_at $delivered_at;
  323.         return $this;
  324.     }
  325.     /**
  326.      * @deprecated use buying price instead
  327.      */
  328.     public function getAmount(): ?string
  329.     {
  330.         return $this->amount;
  331.     }
  332.     /**
  333.      * @deprecated use buying price instead
  334.      */
  335.     public function setAmount(?string $amount): self
  336.     {
  337.         $this->amount $amount;
  338.         return $this;
  339.     }
  340.     public function getDeliveredUnit(): ?int
  341.     {
  342.         return $this->delivered_unit;
  343.     }
  344.     public function setDeliveredUnit(?int $delivered_unit): self
  345.     {
  346.         $this->delivered_unit $delivered_unit;
  347.         return $this;
  348.     }
  349.     public function getContent(): ?string
  350.     {
  351.         return $this->content;
  352.     }
  353.     public function setContent(?string $content): self
  354.     {
  355.         $this->content $content;
  356.         return $this;
  357.     }
  358.     public function getCompleted(): ?bool
  359.     {
  360.         return $this->completed;
  361.     }
  362.     public function setCompleted(?bool $completed): self
  363.     {
  364.         $this->completed $completed;
  365.         return $this;
  366.     }
  367.     public function getComment(): ?string
  368.     {
  369.         return $this->comment;
  370.     }
  371.     public function setComment(?string $comment): self
  372.     {
  373.         $this->comment $comment;
  374.         return $this;
  375.     }
  376.     public function getDeliveredTo(): ?string
  377.     {
  378.         return $this->delivered_to;
  379.     }
  380.     public function setDeliveredTo(?string $delivered_to): self
  381.     {
  382.         $this->delivered_to $delivered_to;
  383.         return $this;
  384.     }
  385.     public function getProjectOrder(): ?ProjectOrders
  386.     {
  387.         return $this->project_order;
  388.     }
  389.     public function setProjectOrder(?ProjectOrders $project_order): self
  390.     {
  391.         $this->project_order $project_order;
  392.         return $this;
  393.     }
  394.     public function getAnSupplier(): ?string
  395.     {
  396.         return $this->an_supplier;
  397.     }
  398.     public function setAnSupplier(?string $an_supplier): self
  399.     {
  400.         $this->an_supplier $an_supplier;
  401.         return $this;
  402.     }
  403.     public function getParentPos():? self
  404.     {
  405.         return $this->parent_pos;
  406.     }
  407.     public function setParentPos(?self $parent_pos): self
  408.     {
  409.         $this->parent_pos $parent_pos;
  410.         return $this;
  411.     }
  412.     /**
  413.      * @return Collection<int, self>
  414.      */
  415.     public function getDecomposedPositions(): Collection
  416.     {
  417.         return $this->decomposed_positions;
  418.     }
  419.     public function addDecomposedPosition(self $decomposedPosition): self
  420.     {
  421.         if (!$this->decomposed_positions->contains($decomposedPosition)) {
  422.             $this->decomposed_positions[] = $decomposedPosition;
  423.             $decomposedPosition->setParentPos($this);
  424.         }
  425.         return $this;
  426.     }
  427.     public function removeDecomposedPosition(self $decomposedPosition): self
  428.     {
  429.         if ($this->decomposed_positions->removeElement($decomposedPosition)) {
  430.             // set the owning side to null (unless already changed)
  431.             if ($decomposedPosition->getParentPos() === $this) {
  432.                 $decomposedPosition->setParentPos(null);
  433.             }
  434.         }
  435.         return $this;
  436.     }
  437.     public function getFileName(): ?string
  438.     {
  439.         return $this->file_name;
  440.     }
  441.     public function setFileName(?string $file_name): self
  442.     {
  443.         $this->file_name $file_name;
  444.         return $this;
  445.     }
  446.     public function getStock(): ?Stocks
  447.     {
  448.         return $this->stock;
  449.     }
  450.     public function setStock(?Stocks $stock): self
  451.     {
  452.         $this->stock $stock;
  453.         return $this;
  454.     }
  455.     public function getBuyingPrice(): ?float
  456.     {
  457.         return $this->buying_price;
  458.     }
  459.     public function setBuyingPrice(?float $buying_price): self
  460.     {
  461.         $this->buying_price $buying_price;
  462.         return $this;
  463.     }
  464.     public function getSalesPrice(): ?float
  465.     {
  466.         return $this->sales_price;
  467.     }
  468.     public function setSalesPrice(?float $sales_price): self
  469.     {
  470.         $this->sales_price $sales_price;
  471.         return $this;
  472.     }
  473.     public function getSalesMargin(): ?float
  474.     {
  475.         return $this->sales_margin;
  476.     }
  477.     public function setSalesMargin(?float $sales_margin): self
  478.     {
  479.         $this->sales_margin $sales_margin;
  480.         return $this;
  481.     }
  482.     public function getPurchaseRequestPosition(): ?PurchaseRequestPositions
  483.     {
  484.         return $this->purchase_request_position;
  485.     }
  486.     public function setPurchaseRequestPosition(?PurchaseRequestPositions $purchase_request_position): self
  487.     {
  488.         $this->purchase_request_position $purchase_request_position;
  489.         return $this;
  490.     }
  491.     public function getDeliveryAmount(): ?float
  492.     {
  493.         return $this->delivery_amount;
  494.     }
  495.     public function setDeliveryAmount(?float $delivery_amount): self
  496.     {
  497.         $this->delivery_amount $delivery_amount;
  498.         return $this;
  499.     }
  500. }