src/Entity/ProjectOrders.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectOrdersRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\Selectable;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. /**
  11.  * @ORM\Entity(repositoryClass=ProjectOrdersRepository::class)
  12.  * @UniqueEntity(
  13.  *     fields={"project_owner_order_nr", "project"},
  14.  *     message="Order nr just one time|Order Owned-Nr: %s Project: %s already registered"
  15.  * )
  16.  */
  17. class ProjectOrders
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      * @Groups({
  24.      *     "order.base",
  25.      *     "project.orders",
  26.      *     "worker.manage.base.timesheet",
  27.      *     "worker.manage.base.timesheet.payments",
  28.      *     "partner.selected.project",
  29.      *
  30.      *     "project.details.orders",
  31.      *     "order.detail",
  32.      * 
  33.      *      "order.moveable",
  34.      *
  35.      *     "project.orders.expense.assigned.order.base",
  36.      *
  37.      *     "project.order.expense.need",
  38.      *
  39.      *     "order.core", "order@core",
  40.      *
  41.      *     "order.minify.core", "order_minify@core",
  42.      *
  43.      *     "project_order@base",
  44.      *     "project_order@core",
  45.      *     "project_order@open_api"
  46.      * })
  47.      */
  48.     private $id;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity=Projects::class, inversedBy="project_orders" )
  51.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  52.      * @Groups({
  53.      *     "order.assigned.project",
  54.      *     "project.order.project",
  55.      *
  56.      *     "project_order@project",
  57.      *
  58.      *
  59.      * })
  60.      */
  61.      #
  62.     private $project;
  63.     /**
  64.      * A manipulated or simulated column is used to prevent circular references.
  65.      * It is used for retrieving the necessary information related to an project in expenses positions to generate
  66.      * a list of minified project for the associated spending
  67.      * @Groups({
  68.      *     "project.orders.expense.position.base",
  69.      *     })
  70.      */
  71.     private array $required_project_details_of_order_for_expense_position;
  72.     /**
  73.      * @return array
  74.      */
  75.     public function getRequiredProjectDetailsOfOrderForExpensePosition(): array
  76.     {
  77.         return [
  78.             "id" => $this->getProject()->getId(),
  79.             "project_id" => $this->getProject()->getProjectId(),
  80.             "name" => $this->getProject()->getName()
  81.         ];
  82.     }
  83.     /**
  84.      * @ORM\Column(type="string", length=64)
  85.      * @Groups({
  86.      *          "project.orders",
  87.      *          "worker.manage.base.timesheet",
  88.      *          "worker.manage.base.timesheet.payments",
  89.      *          "partner.selected.project",
  90.      *
  91.      *     "project.details.orders",
  92.      *     "order.detail",
  93.      *
  94.      *     "order.moveable",
  95.      *     "order.base",
  96.      *     "project.orders.expense.assigned.order.base",
  97.      *
  98.      *     "project.order.expense.need",
  99.      *
  100.      *     "order.core", "order@core",
  101.      *
  102.      *     "project_order@core",
  103.      *     "project_order@base",
  104.      *     "project_order@open_api"
  105.      * })
  106.      */
  107.     private $order_nr;
  108.     /**
  109.      * @ORM\Column(type="text", nullable=true)
  110.      * @Groups({
  111.      *     "project.orders",
  112.      *     "worker.manage.base.timesheet",
  113.      *
  114.      *     "project.details.orders",
  115.      *     "order.detail",
  116.      *
  117.      *     "project_order@core",
  118.      *     "project_order@open_api"
  119.      * })
  120.      */
  121.     private $order_description;
  122.     /**
  123.      * @ORM\Column(type="float")
  124.      * @Groups({
  125.      *     "project.orders",
  126.      *     "worker.manage.base.timesheet",
  127.      *
  128.      *     "project.details.orders",
  129.      *     "order.detail",
  130.      *     "project.order.core",
  131.      *
  132.      *     "project_order@core",
  133.      *     "project_order@base"
  134.      * })
  135.      */
  136.     // TODO This should be replace with order_price
  137.     private $order_price;
  138.     /**
  139.      * @deprecated
  140.      * @ORM\OneToMany(targetEntity=WorkerTimesheetPayments::class, mappedBy="project_order")
  141.      */
  142.     private $workerTimesheetPayments;
  143.     /**
  144.      * @deprecated use status inside feedback
  145.      * @ORM\Column(type="integer", nullable=true)
  146.      * @Groups({
  147.      *     "project.details.orders",
  148.      *     "order.detail",
  149.      *
  150.      *     "project_order@core"
  151.      * })
  152.      */
  153.     private $order_status;
  154.     /**
  155.      * @ORM\Column(type="date_immutable", nullable=true)
  156.      * @Groups({
  157.      *     "project.details.orders",
  158.      *     "order.detail",
  159.      *
  160.      *     "project_order@core",
  161.      * })
  162.      */
  163.     private $should_end_at;
  164.     /**
  165.      * @ORM\Column(type="date_immutable", nullable=true)
  166.      * @Groups({
  167.      *     "project.details.orders",
  168.      *     "order.detail",
  169.      *
  170.      *     "project_order@core",
  171.      * })
  172.      */
  173.     private $is_end_at;
  174.     /**
  175.      * @deprecated ne icin kullanildigi bilinmiyor
  176.      * @ORM\Column(type="float", nullable=true)
  177.      * @Groups({
  178.      *      "project.details.orders",
  179.      *      "order.detail",
  180.      *
  181.      *      "project_order@core",
  182.      *  })
  183.      */
  184.     private $hourly_rate;
  185.     /**
  186.      * @ORM\OneToMany(targetEntity=ProjectOrderFeedback::class, mappedBy="project_order", orphanRemoval=true, cascade={"persist", "remove"})
  187.      * @Groups({
  188.      *      "project.details.orders",
  189.      *      "order.detail",
  190.      *
  191.      *      "project_order@feedbacks",
  192.      *  })
  193.      * @ORM\OrderBy({"created_at": "DESC"})
  194.      */
  195.     private $project_order_feedback;
  196.     /**
  197.      * @deprecated
  198.      * @see Billings
  199.      * @ORM\OneToMany(targetEntity=ProjectOrderInvoices::class, mappedBy="project_order", orphanRemoval=true, cascade={"persist", "remove"})
  200.      * @Groups({
  201.      *       "project.details.orders",
  202.      *       "order.detail",
  203.      *
  204.      *       "project_order@invoices",
  205.      *   })
  206.      * @ORM\OrderBy({"created_at": "DESC"})
  207.      */
  208.     private $project_order_invoices;
  209.     /**
  210.      * @deprecated
  211.      * @see Billings
  212.      * TODO Replace undertaking with order_statement (In ERP world accepted this)
  213.      * @ORM\OneToMany(targetEntity=ProjectOrderUndertakings::class, mappedBy="project_order", cascade={"persist", "remove"})
  214.      * @Groups({
  215.      *          "project.details.orders",
  216.      *          "order.detail",
  217.      *
  218.      *          "project_order@undertakings"
  219.      *    })
  220.      * @ORM\OrderBy({"created_at": "DESC"})
  221.      */
  222.     private $project_order_undertakings;
  223.     /**
  224.      * @ORM\Column(type="date_immutable", nullable=true)
  225.      * @Groups({
  226.      *       "project.details.orders",
  227.      *       "order.detail",
  228.      *
  229.      *       "project_order@core"
  230.      * })
  231.      */
  232.     private $order_at;
  233.     /**
  234.      * @ORM\ManyToOne(targetEntity=ProjectOwnerContactPersons::class, inversedBy="projectOrders")
  235.      * @Groups({
  236.      *        "project.details.orders",
  237.      *        "order.detail",
  238.      *
  239.      *        "project_order@contact_person"
  240.      *  })
  241.      */
  242.     private $contact_person;
  243.     /**
  244.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="projectOrders")
  245.      */
  246.     private $author;
  247.     /**
  248.      * @deprecated use $projectOrderExpenses
  249.      * @ORM\OneToMany(targetEntity=ProjectOrderExtraCosts::class, mappedBy="project_order")
  250.      * @Groups({
  251.      *         "project.details.orders",
  252.      *         "order.detail"
  253.      *    })
  254.      */
  255.     private $project_order_extra_costs;
  256.     /**
  257.      * @ORM\Column(type="string", length=64, nullable=true)    
  258.      * @Groups({
  259.      *     "project.details.orders",
  260.      *     "order.detail",
  261.      *     "order.base",
  262.      *
  263.      *     "project_order@core",
  264.      *     "project_order@base"
  265.      * })
  266.      */
  267.     private $project_owner_order_nr;
  268.     /**
  269.      * TODO ReadMe!
  270.      * @see use Metrics
  271.      * @deprecated
  272.      * @ORM\Column(type="float", nullable=true)
  273.      * @Groups({
  274.      *         "project.details.orders",
  275.      *         "order.detail",
  276.      *
  277.      *         "project_order@core"
  278.      *   })
  279.      */
  280.     private $hours_spent;
  281.     /**
  282.      * TODO ReadMe!
  283.      * @see use Metrics
  284.      * @deprecated
  285.      * @ORM\Column(type="float", nullable=true)
  286.      * @Groups({
  287.      *          "project.details.orders",
  288.      *          "order.detail",
  289.      *
  290.      *          "project_order@core"
  291.      *    })
  292.      */
  293.     private $cost_spent;
  294.     /**
  295.      * @ORM\ManyToOne(targetEntity=InvoiceType::class, inversedBy="projectOrders")
  296.      * ORM\Column(options={"comment": "Type of invoice, this order is standard or Undertaking via (Gutschrift) use as default Partner Invoice type"})
  297.      * @Groups({
  298.      *     "project.details.orders",
  299.      *     "order.detail",
  300.      *
  301.      *     "project_order@invoice_type"
  302.      * })
  303.      */
  304.     private $invoice_type;
  305.     /**
  306.      * ❌❌❌❌❌❌❌❌❌❌❌
  307.      * @deprecated remoce this absolutely
  308.      * TODO this should be move to worker_activity
  309.      * ORM\ManyToOne(targetEntity=Worker::class, inversedBy="projectOrders")
  310.      * @Groups({
  311.      *     "project.details.orders",
  312.      *     "order.detail",
  313.      *     "project.orders.core",
  314.      *
  315.      *     "project.order.lead",
  316.      *
  317.      *     "project_order@lead"
  318.      * })
  319.      */
  320.     private $order_lead;
  321.     /**
  322.      * TODO this should be move to worker_activity
  323.      * @ORM\ManyToOne(targetEntity=WorkerActivities::class, inversedBy="projectOrders")
  324.      * @ORM\JoinColumn(options={"comment": "This relation-ship from merged 'worker' over worker_activities table"})
  325.      * @Groups({
  326.      *     "order.lead.worker.activity",
  327.      *
  328.      *     "project_order@lead_activity"
  329.      * })
  330.      */
  331.     private $order_primary_lead;
  332.     /**
  333.      * @ORM\ManyToMany(targetEntity=WorkerActivities::class)
  334.      * @ORM\JoinTable(
  335.      *     name="project_order_alternate_leads",
  336.      *     joinColumns={@ORM\JoinColumn(name="project_order_id", referencedColumnName="id", onDelete="CASCADE")},
  337.      *     inverseJoinColumns={@ORM\JoinColumn(name="worker_activity_id", referencedColumnName="id")})
  338.      * @Groups({
  339.      *     "worker.alternate.leads",
  340.      *
  341.      *     "project_order@alternate_leads"
  342.      * })
  343.      */
  344.     private $order_alternate_leads;
  345. //    /** TODO Success in Expense Positions
  346. //     * @deprecated
  347. //     * @ORM\OneToMany(targetEntity=ProjectOrderExpenses::class, mappedBy="project_order")
  348. //     * @Groups({
  349. //     *     "project.details.orders.expenses",
  350. //     *
  351. //     *     "project_order@expenses"
  352. //     * })
  353. //     */
  354. //    private $project_order_expenses;
  355.     /**
  356.      * @ORM\OneToMany(targetEntity=ProjectOrderExpensePositions::class, mappedBy="project_order")
  357.      * @Groups({
  358.      *     "project.orders.expense.positions",
  359.      *     "project.orders.expense.minify.version",
  360.      *
  361.      *     "project_order@expense_positions"
  362.      * })
  363.      */
  364.     private $project_order_expense_positions;
  365.     /**
  366.      * @ORM\Column(type="float", nullable=true)
  367.      * @Groups({
  368.      *     "order.detail",
  369.      *     "project.details.orders",
  370.      *     "project.order.core",
  371.      *
  372.      *     "project_order@base",
  373.      *     "project_order@core"
  374.      * })
  375.      */
  376.     private $material_budget;
  377.     /**
  378.      * @ORM\Column(type="float", nullable=true)
  379.      * @Groups({
  380.      *     "order.detail",
  381.      *     "project.details.orders",
  382.      *
  383.      *     "project_order@base",
  384.      *     "project_order@core"
  385.      * })
  386.      */
  387.     private $timesheet_budget;
  388.     /**
  389.      * Prise 10.000 %20 gewinn ziel 2.000
  390.      * Materialkosten: %30 10.000 => 3.300
  391.      * Timesheetkosten: %50 10.000 => 5000
  392.      * 10000 - (3.300 + 5000) => 8.300
  393.      * 10 2000
  394.      * ? 1700
  395.      */
  396.     /**
  397.      * @ORM\Column(type="float", nullable=true)
  398.      * @Groups({
  399.      *      "order.detail",
  400.      *      "project.details.orders",
  401.      *
  402.      *      "project_order@base",
  403.      *      "project_order@core"
  404.      *  })
  405.      */
  406.     private $target_profit;
  407.     /**
  408.      * @ORM\ManyToOne(targetEntity=Branches::class, inversedBy="projectOrders")
  409.      * @Groups({
  410.      *     "branch",
  411.      *     "project.order.branch",
  412.      *     "order.base",
  413.      *
  414.      *     "project_order@branches"
  415.      * })
  416.      */
  417.     private $order_branch;
  418.     /**
  419.      * @ORM\ManyToOne(targetEntity=BranchDepartments::class, inversedBy="project_orders")
  420.      * @Groups({
  421.      *     "branch.department",
  422.      *     "project.order.branch.department",
  423.      *
  424.      *     "project_order_branch@departments",
  425.      *
  426.      *     "project_order@branch_departments"
  427.      * })
  428.      */
  429.     private $branch_department;
  430.     /**
  431.      * @ORM\ManyToMany(targetEntity=WorkerActivities::class, inversedBy="assigned_orders")
  432.      */
  433.     private $assigned_workers;
  434.     /**
  435.      * // Kime Verilmis (Human)
  436.      * @ORM\OneToMany(targetEntity=StockIssue::class, mappedBy="project_order")
  437.      * @Groups({
  438.      *      "project_order@stock_issues"
  439.      *  })
  440.      */
  441.     private $stock_issues;
  442.     /**
  443.      * @ORM\OneToMany(targetEntity=StockTransactions::class, mappedBy="project_order")
  444.      * @Groups({
  445.      *      "project_order@stock_transaction"
  446.      *  })
  447.      */
  448.     private $stock_transactions;
  449.     /**
  450.      * @ORM\OneToOne(targetEntity=ProjectOrderMetrics::class, mappedBy="project_order", cascade={"persist", "remove"})
  451.      * @Groups({
  452.      *     "project_order@order_metrics"
  453.      * })
  454.      */
  455.     private $project_order_metrics;
  456.     /**
  457.      * @ORM\OneToMany(targetEntity=ProjectOrderTasks::class, mappedBy="project_order", orphanRemoval=true, cascade={"persist"})
  458.      * @Groups({
  459.      *      "project_order@order_tasks"
  460.      *  })
  461.      */
  462.     private $project_order_tasks;
  463.     /**
  464.      * @ORM\Column(type="datetime_immutable", nullable=true)
  465.      */
  466.     private $created_at;
  467.     /**
  468.      * TODO BU Billinge Bagli olmali
  469.      * @ORM\OneToMany(targetEntity=InvoicePositions::class, mappedBy="project_order")
  470.      */
  471.     private $invoice_positions;
  472.     /**
  473.      * @ORM\OneToMany(targetEntity=ProjectOrderBillings::class, mappedBy="project_order", orphanRemoval=true, cascade={"persist"})
  474.      * @Groups({
  475.      *       "project_order@billings"
  476.      *   })
  477.      */
  478.     private $order_billings;
  479.     public function __construct()
  480.     {
  481.         $this->workerTimesheetPayments = new ArrayCollection();
  482.         $this->project_order_feedback = new ArrayCollection();
  483.         $this->project_order_invoices = new ArrayCollection();
  484.         $this->project_order_extra_costs = new ArrayCollection();
  485.         $this->project_order_undertakings = new ArrayCollection();
  486.         # $this->project_order_expenses = new ArrayCollection();
  487.         $this->project_order_expense_positions = new ArrayCollection();
  488.         $this->order_alternate_leads = new ArrayCollection();
  489.         $this->assigned_workers = new ArrayCollection();
  490.         $this->stock_issues = new ArrayCollection();
  491.         $this->stock_transactions = new ArrayCollection();
  492.         $this->project_order_tasks = new ArrayCollection();
  493.         $this->invoice_positions = new ArrayCollection();
  494.         $this->order_billings = new ArrayCollection();
  495.     }
  496.     public function getId(): ?int
  497.     {
  498.         return $this->id;
  499.     }
  500.     public function getProject(): ?Projects
  501.     {
  502.         return $this->project;
  503.     }
  504.     public function setProject(?Projects $project): self
  505.     {
  506.         $this->project $project;
  507.         return $this;
  508.     }
  509.     public function getOrderNr(): ?string
  510.     {
  511.         return $this->order_nr;
  512.     }
  513.     public function setOrderNr(string $order_nr): self
  514.     {
  515.         $this->order_nr $order_nr;
  516.         return $this;
  517.     }
  518.     public function getOrderDescription(): ?string
  519.     {
  520.         return $this->order_description;
  521.     }
  522.     public function setOrderDescription(?string $order_description): self
  523.     {
  524.         $this->order_description $order_description;
  525.         return $this;
  526.     }
  527.     public function getOrderPrice(): ?float
  528.     {
  529.         return $this->order_price;
  530.     }
  531.     public function setOrderPrice(float $order_price): self
  532.     {
  533.         $this->order_price $order_price;
  534.         return $this;
  535.     }
  536.     /**
  537.      * @return Collection<int, WorkerTimesheetPayments>
  538.      */
  539.     public function getWorkerTimesheetPayments(): Collection
  540.     {
  541.         return $this->workerTimesheetPayments;
  542.     }
  543.     public function addWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  544.     {
  545.         if (!$this->workerTimesheetPayments->contains($workerTimesheetPayment)) {
  546.             $this->workerTimesheetPayments[] = $workerTimesheetPayment;
  547.             $workerTimesheetPayment->setProjectOrder($this);
  548.         }
  549.         return $this;
  550.     }
  551.     public function removeWorkerTimesheetPayment(WorkerTimesheetPayments $workerTimesheetPayment): self
  552.     {
  553.         if ($this->workerTimesheetPayments->removeElement($workerTimesheetPayment)) {
  554.             // set the owning side to null (unless already changed)
  555.             if ($workerTimesheetPayment->getProjectOrder() === $this) {
  556.                 $workerTimesheetPayment->setProjectOrder(null);
  557.             }
  558.         }
  559.         return $this;
  560.     }
  561.     /**
  562.      * @deprecated since 1.27 (to be removed in 2.0). Use getOrderStatus() instead feedback.
  563.      */
  564.     public function getOrderStatus(): ?int
  565.     {
  566.         return $this->order_status;
  567.     }
  568.     /**
  569.      * @deprecated since 1.27 (to be removed in 2.0). Use getOrderStatus() instead feedback.
  570.     */
  571.     public function setOrderStatus(?int $order_status): self
  572.     {
  573.         $this->order_status $order_status;
  574.         return $this;
  575.     }
  576.     public function getShouldEndAt(): ?\DateTimeImmutable
  577.     {
  578.         return $this->should_end_at;
  579.     }
  580.     public function setShouldEndAt(?\DateTimeImmutable $should_end_at): self
  581.     {
  582.         $this->should_end_at $should_end_at;
  583.         return $this;
  584.     }
  585.     public function getIsEndAt(): ?\DateTimeImmutable
  586.     {
  587.         return $this->is_end_at;
  588.     }
  589.     public function setIsEndAt(?\DateTimeImmutable $is_end_at): self
  590.     {
  591.         $this->is_end_at $is_end_at;
  592.         return $this;
  593.     }
  594.     /**
  595.      * @param float|null $hourly_rate
  596.      * @deprecated ne icin kullanildigi bilinmiyor
  597.      */
  598.     public function getHourlyRate(): ?float
  599.     {
  600.         return $this->hourly_rate;
  601.     }
  602.     /**
  603.      * @param float|null $hourly_rate
  604.      * @deprecated ne icin kullanildigi bilinmiyor
  605.      */
  606.     public function setHourlyRate(?float $hourly_rate): self
  607.     {
  608.         $this->hourly_rate $hourly_rate;
  609.         return $this;
  610.     }
  611.     /**
  612.      * @return Collection<int, ProjectOrderFeedback>
  613.      */
  614.     public function getProjectOrderFeedback(): Collection
  615.     {
  616.         return $this->project_order_feedback;
  617.     }
  618.     public function addProjectOrderFeedback(ProjectOrderFeedback $projectOrderFeedback): self
  619.     {
  620.         if (!$this->project_order_feedback->contains($projectOrderFeedback)) {
  621.             $this->project_order_feedback[] = $projectOrderFeedback;
  622.             $projectOrderFeedback->setProjectOrder($this);
  623.         }
  624.         return $this;
  625.     }
  626.     public function removeProjectOrderFeedback(ProjectOrderFeedback $projectOrderFeedback): self
  627.     {
  628.         if ($this->project_order_feedback->removeElement($projectOrderFeedback)) {
  629.             // set the owning side to null (unless already changed)
  630.             if ($projectOrderFeedback->getProjectOrder() === $this) {
  631.                 $projectOrderFeedback->setProjectOrder(null);
  632.             }
  633.         }
  634.         return $this;
  635.     }
  636.     /**
  637.      * @return Collection<int, ProjectOrderInvoices>
  638.      * @deprecated
  639.      * @see ProjectOrderBillings instead
  640.      */
  641.     public function getProjectOrderInvoices(): Collection
  642.     {
  643.         return $this->project_order_invoices;
  644.     }
  645.     /**
  646.      * @deprecated
  647.      * @see ProjectOrderBillings instead
  648.      */
  649.     public function addProjectOrderInvoice(ProjectOrderInvoices $projectOrderInvoice): self
  650.     {
  651.         if (!$this->project_order_invoices->contains($projectOrderInvoice)) {
  652.             $this->project_order_invoices[] = $projectOrderInvoice;
  653.             $projectOrderInvoice->setProjectOrder($this);
  654.         }
  655.         return $this;
  656.     }
  657.     /**
  658.      * @deprecated
  659.      * @see ProjectOrderBillings instead
  660.      */
  661.     public function removeProjectOrderInvoice(ProjectOrderInvoices $projectOrderInvoice): self
  662.     {
  663.         if ($this->project_order_invoices->removeElement($projectOrderInvoice)) {
  664.             // set the owning side to null (unless already changed)
  665.             if ($projectOrderInvoice->getProjectOrder() === $this) {
  666.                 $projectOrderInvoice->setProjectOrder(null);
  667.             }
  668.         }
  669.         return $this;
  670.     }
  671.     public function getOrderAt(): ?\DateTimeImmutable
  672.     {
  673.         return $this->order_at;
  674.     }
  675.     public function setOrderAt(?\DateTimeImmutable $order_at): self
  676.     {
  677.         $this->order_at $order_at;
  678.         return $this;
  679.     }
  680.     public function getContactPerson(): ?ProjectOwnerContactPersons
  681.     {
  682.         return $this->contact_person;
  683.     }
  684.     public function setContactPerson(?ProjectOwnerContactPersons $contact_person): self
  685.     {
  686.         $this->contact_person $contact_person;
  687.         return $this;
  688.     }
  689.     public function getAuthor(): ?User
  690.     {
  691.         return $this->author;
  692.     }
  693.     public function setAuthor(?User $author): self
  694.     {
  695.         $this->author $author;
  696.         return $this;
  697.     }
  698.     /**
  699.      * @return Collection<int, ProjectOrderExtraCosts>
  700.      */
  701.     public function getProjectOrderExtraCosts(): Collection
  702.     {
  703.         return $this->project_order_extra_costs;
  704.     }
  705.     public function addProjectOrderExtraCost(ProjectOrderExtraCosts $projectOrderExtraCost): self
  706.     {
  707.         if (!$this->project_order_extra_costs->contains($projectOrderExtraCost)) {
  708.             $this->project_order_extra_costs[] = $projectOrderExtraCost;
  709.             $projectOrderExtraCost->setProjectOrder($this);
  710.         }
  711.         return $this;
  712.     }
  713.     public function removeProjectOrderExtraCost(ProjectOrderExtraCosts $projectOrderExtraCost): self
  714.     {
  715.         if ($this->project_order_extra_costs->removeElement($projectOrderExtraCost)) {
  716.             // set the owning side to null (unless already changed)
  717.             if ($projectOrderExtraCost->getProjectOrder() === $this) {
  718.                 $projectOrderExtraCost->setProjectOrder(null);
  719.             }
  720.         }
  721.         return $this;
  722.     }
  723.     public function getProjectOwnerOrderNr(): ?string
  724.     {
  725.         return $this->project_owner_order_nr;
  726.     }
  727.     public function setProjectOwnerOrderNr(?string $project_owner_order_nr): self
  728.     {
  729.         $this->project_owner_order_nr $project_owner_order_nr;
  730.         return $this;
  731.     }
  732.     /**
  733.      * TODO ReadMe!
  734.      * @see use Metrics
  735.      * @deprecated
  736.      */
  737.     public function getHoursSpent(): ?float
  738.     {
  739.         return $this->hours_spent;
  740.     }
  741.     /**
  742.      * TODO ReadMe!
  743.      * @see use Metrics
  744.      * @deprecated
  745.      */
  746.     public function setHoursSpent(?float $hours_spent): self
  747.     {
  748.         $this->hours_spent $hours_spent;
  749.         return $this;
  750.     }
  751.     /**
  752.      * TODO ReadMe!
  753.      * @see use Metrics
  754.      * @deprecated
  755.     */
  756.     public function getCostSpent(): ?float
  757.     {
  758.         return $this->cost_spent;
  759.     }
  760.     /**
  761.      * TODO ReadMe!
  762.      * @see use Metrics
  763.      * @deprecated
  764.      */
  765.     public function setCostSpent(?float $cost_spent): self
  766.     {
  767.         $this->cost_spent $cost_spent;
  768.         return $this;
  769.     }
  770.     /**
  771.      * @return Collection<int, ProjectOrderUndertakings>
  772.      * @deprecated
  773.      * @see ProjectOrderBillings instead
  774.      */
  775.     public function getProjectOrderUndertakings(): Collection
  776.     {
  777.         return $this->project_order_undertakings;
  778.     }
  779.     /**
  780.      * @deprecated
  781.      * @see ProjectOrderBillings instead
  782.      */
  783.     public function addProjectOrderUndertaking(ProjectOrderUndertakings $project_order_undertaking): self
  784.     {
  785.         if (!$this->project_order_undertakings->contains($project_order_undertaking)) {
  786.             $this->project_order_undertakings[] = $project_order_undertaking;
  787.             $project_order_undertaking->setProjectOrder($this);
  788.         }
  789.         return $this;
  790.     }
  791.     /**
  792.      * @deprecated
  793.      * @see ProjectOrderBillings instead
  794.      */
  795.     public function removeProjectOrderUndetaking(ProjectOrderUndertakings $project_order_undertaking): self
  796.     {
  797.         if ($this->project_order_undertakings->removeElement($project_order_undertaking)) {
  798.             // set the owning side to null (unless already changed)
  799.             if ($project_order_undertaking->getProjectOrder() === $this) {
  800.                 $project_order_undertaking->setProjectOrder(null);
  801.             }
  802.         }
  803.         return $this;
  804.     }
  805.     public function getInvoiceType(): ?InvoiceType
  806.     {
  807.         return $this->invoice_type;
  808.     }
  809.     public function setInvoiceType(?InvoiceType $invoice_type): self
  810.     {
  811.         $this->invoice_type $invoice_type;
  812.         return $this;
  813.     }
  814.     public function getOrderPrimaryLead(): ?WorkerActivities
  815.     {
  816.         return $this->order_primary_lead;
  817.     }
  818.     public function setOrderPrimaryLead(?WorkerActivities $order_lead): self
  819.     {
  820.         $this->order_primary_lead $order_lead;
  821.         return $this;
  822.     }
  823. //    /**
  824. //     * @return Collection<int, ProjectOrderExpenses>
  825. //     */
  826. //    public function getProjectOrderExpenses(): Collection
  827. //    {
  828. //        return $this->project_order_expenses;
  829. //    }
  830. //
  831. //    public function addProjectOrderExpense(ProjectOrderExpenses $projectOrderExpense): self
  832. //    {
  833. //        if (!$this->project_order_expenses->contains($projectOrderExpense)) {
  834. //            $this->project_order_expenses[] = $projectOrderExpense;
  835. //            $projectOrderExpense->setProjectOrder($this);
  836. //        }
  837. //
  838. //        return $this;
  839. //    }
  840. //
  841. //    public function removeProjectOrderExpense(ProjectOrderExpenses $projectOrderExpense): self
  842. //    {
  843. //        if ($this->project_order_expenses->removeElement($projectOrderExpense)) {
  844. //            // set the owning side to null (unless already changed)
  845. //            if ($projectOrderExpense->getProjectOrder() === $this) {
  846. //                $projectOrderExpense->setProjectOrder(null);
  847. //            }
  848. //        }
  849. //
  850. //        return $this;
  851. //    }
  852.     /**
  853.      * @return Collection<int, ProjectOrderExpensePositions>&Selectable
  854.      */
  855.     public function getProjectOrderExpensePositions(): Collection
  856.     {
  857.         return $this->project_order_expense_positions;
  858.     }
  859.     public function addProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
  860.     {
  861.         if (!$this->project_order_expense_positions->contains($projectOrderExpensePosition)) {
  862.             $this->project_order_expense_positions[] = $projectOrderExpensePosition;
  863.             $projectOrderExpensePosition->setProjectOrder($this);
  864.         }
  865.         return $this;
  866.     }
  867.     public function removeProjectOrderExpensePosition(ProjectOrderExpensePositions $projectOrderExpensePosition): self
  868.     {
  869.         if ($this->project_order_expense_positions->removeElement($projectOrderExpensePosition)) {
  870.             // set the owning side to null (unless already changed)
  871.             if ($projectOrderExpensePosition->getProjectOrder() === $this) {
  872.                 $projectOrderExpensePosition->setProjectOrder(null);
  873.             }
  874.         }
  875.         return $this;
  876.     }
  877.     public function getMaterialBudget(): ?float
  878.     {
  879.         return $this->material_budget;
  880.     }
  881.     public function setMaterialBudget(?float $material_budget): self
  882.     {
  883.         $this->material_budget $material_budget;
  884.         return $this;
  885.     }
  886.     public function getTimesheetBudget(): ?float
  887.     {
  888.         return $this->timesheet_budget;
  889.     }
  890.     public function setTimesheetBudget(?float $timesheet_budget): self
  891.     {
  892.         $this->timesheet_budget $timesheet_budget;
  893.         return $this;
  894.     }
  895.     public function getTargetProfit(): ?float
  896.     {
  897.         return $this->target_profit;
  898.     }
  899.     public function setTargetProfit(?float $target_profit): self
  900.     {
  901.         $this->target_profit $target_profit;
  902.         return $this;
  903.     }
  904.     /**
  905.      * @return Collection<int, WorkerActivities>
  906.      */
  907.     public function getOrderAlternateLeads(): Collection
  908.     {
  909.         return $this->order_alternate_leads;
  910.     }
  911.     public function addOrderAlternateLead(WorkerActivities $orderAlternateLead): self
  912.     {
  913.         if (!$this->order_alternate_leads->contains($orderAlternateLead)) {
  914.             $this->order_alternate_leads[] = $orderAlternateLead;
  915.         }
  916.         return $this;
  917.     }
  918.     public function removeOrderAlternateLead(WorkerActivities $orderAlternateLead): self
  919.     {
  920.         $this->order_alternate_leads->removeElement($orderAlternateLead);
  921.         return $this;
  922.     }
  923.     public function getOrderBranch(): ?Branches
  924.     {
  925.         return $this->order_branch;
  926.     }
  927.     public function setOrderBranch(?Branches $order_branch): self
  928.     {
  929.         $this->order_branch $order_branch;
  930.         return $this;
  931.     }
  932.     public function getBranchDepartment(): ?BranchDepartments
  933.     {
  934.         return $this->branch_department;
  935.     }
  936.     public function setBranchDepartment(?BranchDepartments $branch_department): self
  937.     {
  938.         $this->branch_department $branch_department;
  939.         return $this;
  940.     }
  941.     /**
  942.      * @return Collection<int, WorkerActivities>
  943.      */
  944.     public function getAssignedWorkers(): Collection
  945.     {
  946.         return $this->assigned_workers;
  947.     }
  948.     public function addAssignedWorker(WorkerActivities $assignedWorker): self
  949.     {
  950.         if (!$this->assigned_workers->contains($assignedWorker)) {
  951.             $this->assigned_workers[] = $assignedWorker;
  952.         }
  953.         return $this;
  954.     }
  955.     public function removeAssignedWorker(WorkerActivities $assignedWorker): self
  956.     {
  957.         $this->assigned_workers->removeElement($assignedWorker);
  958.         return $this;
  959.     }
  960.     /**
  961.      * @return Collection<int, StockIssue>
  962.      */
  963.     public function getStockIssues(): Collection
  964.     {
  965.         return $this->stock_issues;
  966.     }
  967.     public function addStockIssue(StockIssue $stockIssue): self
  968.     {
  969.         if (!$this->stock_issues->contains($stockIssue)) {
  970.             $this->stock_issues[] = $stockIssue;
  971.             $stockIssue->setProjectOrder($this);
  972.         }
  973.         return $this;
  974.     }
  975.     public function removeStockIssue(StockIssue $stockIssue): self
  976.     {
  977.         if ($this->stock_issues->removeElement($stockIssue)) {
  978.             // set the owning side to null (unless already changed)
  979.             if ($stockIssue->getProjectOrder() === $this) {
  980.                 $stockIssue->setProjectOrder(null);
  981.             }
  982.         }
  983.         return $this;
  984.     }
  985.     /**
  986.      * @return Collection<int, StockTransactions>&Selectable
  987.      */
  988.     public function getStockTransactions(): Collection
  989.     {
  990.         return $this->stock_transactions;
  991.     }
  992.     public function addStockTransaction(StockTransactions $stockTransaction): self
  993.     {
  994.         if (!$this->stock_transactions->contains($stockTransaction)) {
  995.             $this->stock_transactions[] = $stockTransaction;
  996.             $stockTransaction->setProjectOrder($this);
  997.         }
  998.         return $this;
  999.     }
  1000.     public function removeStockTransaction(StockTransactions $stockTransaction): self
  1001.     {
  1002.         if ($this->stock_transactions->removeElement($stockTransaction)) {
  1003.             // set the owning side to null (unless already changed)
  1004.             if ($stockTransaction->getProjectOrder() === $this) {
  1005.                 $stockTransaction->setProjectOrder(null);
  1006.             }
  1007.         }
  1008.         return $this;
  1009.     }
  1010.     public function getProjectOrderMetrics(): ?ProjectOrderMetrics
  1011.     {
  1012.         return $this->project_order_metrics;
  1013.     }
  1014.     public function setProjectOrderMetrics(ProjectOrderMetrics $project_order_metrics): self
  1015.     {
  1016.         // set the owning side of the relation if necessary
  1017.         if ($project_order_metrics->getProjectOrder() !== $this) {
  1018.             $project_order_metrics->setProjectOrder($this);
  1019.         }
  1020.         $this->project_order_metrics $project_order_metrics;
  1021.         return $this;
  1022.     }
  1023.     /**
  1024.      * Bu interface, bir collection’ın Criteria kullanılarak filtrelenebileceğini garanti eder.
  1025.      * matching kullanmak icin Selectable sart
  1026.      * Return tanimlama
  1027.      * 1️⃣ Collection<int, ProjectOrderTasks>&Selectable
  1028.      * 2️⃣ Collection|Selectable|ProjectOrderTasks[]
  1029.      *
  1030.      * @return Collection<int, ProjectOrderTasks>&Selectable
  1031.      */
  1032.     public function getProjectOrderTasks(): Collection
  1033.     {
  1034.         return $this->project_order_tasks;
  1035.     }
  1036.     public function addProjectOrderTask(ProjectOrderTasks $projectOrderTask): self
  1037.     {
  1038.         if (!$this->project_order_tasks->contains($projectOrderTask)) {
  1039.             $this->project_order_tasks[] = $projectOrderTask;
  1040.             $projectOrderTask->setProjectOrder($this);
  1041.         }
  1042.         return $this;
  1043.     }
  1044.     public function removeProjectOrderTask(ProjectOrderTasks $projectOrderTask): self
  1045.     {
  1046.         if ($this->project_order_tasks->removeElement($projectOrderTask)) {
  1047.             // set the owning side to null (unless already changed)
  1048.             if ($projectOrderTask->getProjectOrder() === $this) {
  1049.                 $projectOrderTask->setProjectOrder(null);
  1050.             }
  1051.         }
  1052.         return $this;
  1053.     }
  1054.     public function getCreatedAt(): ?\DateTimeImmutable
  1055.     {
  1056.         return $this->created_at;
  1057.     }
  1058.     public function setCreatedAt(?\DateTimeImmutable $created_at): self
  1059.     {
  1060.         $this->created_at $created_at;
  1061.         return $this;
  1062.     }
  1063.     /**
  1064.      * @return Collection<int, InvoicePositions>
  1065.      */
  1066.     public function getInvoicePositions(): Collection
  1067.     {
  1068.         return $this->invoice_positions;
  1069.     }
  1070.     public function addInvoicePosition(InvoicePositions $invoicePosition): self
  1071.     {
  1072.         if (!$this->invoice_positions->contains($invoicePosition)) {
  1073.             $this->invoice_positions[] = $invoicePosition;
  1074.             $invoicePosition->setProjectOrder($this);
  1075.         }
  1076.         return $this;
  1077.     }
  1078.     public function removeInvoicePosition(InvoicePositions $invoicePosition): self
  1079.     {
  1080.         if ($this->invoice_positions->removeElement($invoicePosition)) {
  1081.             // set the owning side to null (unless already changed)
  1082.             if ($invoicePosition->getProjectOrder() === $this) {
  1083.                 $invoicePosition->setProjectOrder(null);
  1084.             }
  1085.         }
  1086.         return $this;
  1087.     }
  1088.     /**
  1089.      * @return Collection<int, ProjectOrderBillings>&Selectable
  1090.      */
  1091.     public function getOrderBillings(): Collection
  1092.     {
  1093.         return $this->order_billings;
  1094.     }
  1095.     public function addProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
  1096.     {
  1097.         if (!$this->order_billings->contains($projectOrderBilling)) {
  1098.             $this->order_billings[] = $projectOrderBilling;
  1099.             $projectOrderBilling->setProjectOrder($this);
  1100.         }
  1101.         return $this;
  1102.     }
  1103.     public function removeProjectOrderBilling(ProjectOrderBillings $projectOrderBilling): self
  1104.     {
  1105.         if ($this->order_billings->removeElement($projectOrderBilling)) {
  1106.             // set the owning side to null (unless already changed)
  1107.             if ($projectOrderBilling->getProjectOrder() === $this) {
  1108.                 $projectOrderBilling->setProjectOrder(null);
  1109.             }
  1110.         }
  1111.         return $this;
  1112.     }
  1113.     /**
  1114.      * Bağlı works plan (varsa). Plan otorite olduğunda Order task/job satırları Plan'ın aynası.
  1115.      * Çift bağ (works_plan.project_order ↔ project_orders.works_plan) WorksPlanBindService
  1116.      * tarafından synchronize edilir.
  1117.      *
  1118.      * @ORM\OneToOne(targetEntity=WorksPlan::class)
  1119.      * @ORM\JoinColumn(name="works_plan_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  1120.      * @Groups({
  1121.      *     "project_order@core",
  1122.      *     "project_order@works_plan"
  1123.      * })
  1124.      */
  1125.     private $works_plan;
  1126.     public function getWorksPlan(): ?WorksPlan
  1127.     {
  1128.         return $this->works_plan;
  1129.     }
  1130.     public function setWorksPlan(?WorksPlan $works_plan): self
  1131.     {
  1132.         $this->works_plan $works_plan;
  1133.         return $this;
  1134.     }
  1135.     /**
  1136.      * Plan yöneticisinin verdiği kalite puanı (0-5) — plana bağlı order'ın plan
  1137.      * doğrultusundaki kalitesini gösterir. Order list + dialog'da read-only gösterilir.
  1138.      *
  1139.      * @ORM\Column(type="float", nullable=true)
  1140.      * @Groups({
  1141.      *     "project_order@core",
  1142.      *     "project_order@base"
  1143.      * })
  1144.      */
  1145.     private $plan_rating;
  1146.     public function getPlanRating(): ?float
  1147.     {
  1148.         return $this->plan_rating;
  1149.     }
  1150.     public function setPlanRating(?float $plan_rating): self
  1151.     {
  1152.         $this->plan_rating $plan_rating;
  1153.         return $this;
  1154.     }
  1155. }