src/Entity/Opportunity.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OpportunityRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClass: OpportunityRepository::class)]
  9. class Opportunity
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id = null;
  15.     #[ORM\Column(length: 255)]
  16.     private ?string $name = null;
  17.     #[ORM\Column(length: 255)]
  18.     private ?string $phone = null;
  19.     #[ORM\Column(length: 255)]
  20.     private ?string $email = null;
  21.     #[ORM\Column(length: 255, nullable: true)]
  22.     private ?string $display_name = null;
  23.     #[ORM\Column(nullable: true)]
  24.     private ?int $priority = null;
  25.     #[ORM\Column(length: 255)]
  26.     private ?string $stage = null;
  27.     #[ORM\Column]
  28.     private ?int $expected_revenue = null;
  29.     #[ORM\Column]
  30.     private ?int $probability = null;
  31.     #[ORM\Column(type: Types::DATETIME_MUTABLE)]
  32.     private ?\DateTimeInterface $create_date = null;
  33.     #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  34.     private ?\DateTimeInterface $date_last_stage_update = null;
  35.     #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  36.     private ?\DateTimeInterface $date_open = null;
  37.     #[ORM\Column(nullable: true)]
  38.     private ?bool $active = null;
  39.     #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  40.     private ?\DateTimeInterface $date_closed = null;
  41.     #[ORM\ManyToOne(inversedBy: 'opportunities')]
  42.     #[ORM\JoinColumn(nullable: true)]
  43.     private ?Clients $client = null;
  44.     #[ORM\ManyToOne(inversedBy: 'opportunities')]
  45.     #[ORM\JoinColumn(nullable: true)]
  46.     private ?User $user = null;
  47.     #[ORM\ManyToOne(inversedBy: 'opportunities')]
  48.     #[ORM\JoinColumn(nullable: true)]
  49.     private ?UserOdoo $userOdoo = null;
  50.     #[ORM\OneToMany(mappedBy: 'opportunity', targetEntity: Devis::class)]
  51.     private Collection $devises;
  52.     #[ORM\Column(length: 255)]
  53.     private ?string $state = null;
  54.     #[ORM\Column(length: 255, nullable: true)]
  55.     private ?string $identifiant_odoo = null;
  56.     #[ORM\Column(nullable: true)]
  57.     private ?int $day_open = null;
  58.     #[ORM\Column(nullable: true)]
  59.     private ?int $day_close = null;
  60.     #[ORM\Column(nullable: true)]
  61.     private ?int $user_id_odoo = null;
  62.     #[ORM\Column(nullable: true)]
  63.     private ?int $client_id_odoo = null;
  64.     #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  65.     private ?\DateTimeInterface $last_organized_datas = null;
  66.     public function __construct()
  67.     {
  68.         $this->devises = new ArrayCollection();
  69.     }
  70.     /**
  71.      * fill all class properties from array
  72.      *
  73.      * @param array $row => array of properties
  74.      * @return self
  75.      */
  76.     public static function withRow( array $row , $instance = null) {
  77.         if(empty($instance))
  78.             $instance = new self();
  79.         $instance->fill($row);
  80.         return $instance;
  81.     }
  82.     protected function fill( array $row ) {
  83.         // fill all properties from array
  84.         foreach($row as $key=>$value)
  85.         {
  86.             $this->$key = $value;
  87.         }
  88.     }
  89.     
  90.     public function getId(): ?int
  91.     {
  92.         return $this->id;
  93.     }
  94.     public function getName(): ?string
  95.     {
  96.         return $this->name;
  97.     }
  98.     public function setName(string $name): self
  99.     {
  100.         $this->name = $name;
  101.         return $this;
  102.     }
  103.     public function getPhone(): ?string
  104.     {
  105.         return $this->phone;
  106.     }
  107.     public function setPhone(string $phone): self
  108.     {
  109.         $this->phone = $phone;
  110.         return $this;
  111.     }
  112.     public function getEmail(): ?string
  113.     {
  114.         return $this->email;
  115.     }
  116.     public function setEmail(string $email): self
  117.     {
  118.         $this->email = $email;
  119.         return $this;
  120.     }
  121.     public function getDisplayName(): ?string
  122.     {
  123.         return $this->display_name;
  124.     }
  125.     public function setDisplayName(?string $display_name): self
  126.     {
  127.         $this->display_name = $display_name;
  128.         return $this;
  129.     }
  130.     public function getPriority(): ?int
  131.     {
  132.         return $this->priority;
  133.     }
  134.     public function setPriority(?int $priority): self
  135.     {
  136.         $this->priority = $priority;
  137.         return $this;
  138.     }
  139.     public function getCreateDate(): ?\DateTimeInterface
  140.     {
  141.         return $this->create_date;
  142.     }
  143.     public function setCreateDate(\DateTimeInterface $create_date): self
  144.     {
  145.         $this->create_date = $create_date;
  146.         return $this;
  147.     }
  148.     public function getDateLastStageUpdate(): ?\DateTimeInterface
  149.     {
  150.         return $this->date_last_stage_update;
  151.     }
  152.     public function setDateLastStageUpdate(?\DateTimeInterface $date_last_stage_update): self
  153.     {
  154.         $this->date_last_stage_update = $date_last_stage_update;
  155.         return $this;
  156.     }
  157.     public function getDateOpen(): ?\DateTimeInterface
  158.     {
  159.         return $this->date_open;
  160.     }
  161.     public function setDateOpen(?\DateTimeInterface $date_open): self
  162.     {
  163.         $this->date_open = $date_open;
  164.         return $this;
  165.     }
  166.     public function isActive(): ?bool
  167.     {
  168.         return $this->active;
  169.     }
  170.     public function setActive(?bool $active): self
  171.     {
  172.         $this->active = $active;
  173.         return $this;
  174.     }
  175.     public function getDateClosed(): ?\DateTimeInterface
  176.     {
  177.         return $this->date_closed;
  178.     }
  179.     public function setDateClosed(?\DateTimeInterface $date_closed): self
  180.     {
  181.         $this->date_closed = $date_closed;
  182.         return $this;
  183.     }
  184.     public function getClient(): ?Clients
  185.     {
  186.         return $this->client;
  187.     }
  188.     public function setClient(?Clients $client): self
  189.     {
  190.         $this->client = $client;
  191.         return $this;
  192.     }
  193.     public function getUser(): ?User
  194.     {
  195.         return $this->user;
  196.     }
  197.     public function setUser(?User $user): self
  198.     {
  199.         $this->user = $user;
  200.         return $this;
  201.     }
  202.     public function getUserOdoo(): ?UserOdoo
  203.     {
  204.         return $this->userOdoo;
  205.     }
  206.     public function setUserOdoo(?UserOdoo $user): self
  207.     {
  208.         $this->userOdoo = $user;
  209.         return $this;
  210.     }
  211.     
  212.     /**
  213.      * @return Collection<int, Devis>
  214.      */
  215.     public function getDevises(): Collection
  216.     {
  217.         return $this->devises;
  218.     }
  219.     public function addDevise(Devis $devise): self
  220.     {
  221.         if (!$this->devises->contains($devise)) {
  222.             $this->devises->add($devise);
  223.             $devise->setOpportunity($this);
  224.         }
  225.         return $this;
  226.     }
  227.     public function removeDevise(Devis $devise): self
  228.     {
  229.         if ($this->devises->removeElement($devise)) {
  230.             // set the owning side to null (unless already changed)
  231.             if ($devise->getOpportunity() === $this) {
  232.                 $devise->setOpportunity(null);
  233.             }
  234.         }
  235.         return $this;
  236.     }
  237.     public function getState(): ?string
  238.     {
  239.         return $this->state;
  240.     }
  241.     public function setState(string $state): self
  242.     {
  243.         $this->state = $state;
  244.         return $this;
  245.     }
  246.     public function getStage(): ?string
  247.     {
  248.         return $this->stage;
  249.     }
  250.     public function setStage(string $stage): self
  251.     {
  252.         $this->stage = $stage;
  253.         return $this;
  254.     }
  255.     public function getExpectedRevenue(): ?int
  256.     {
  257.         return $this->expected_revenue;
  258.     }
  259.     public function setExpectedRevenue(int $expected_revenue): self
  260.     {
  261.         $this->expected_revenue = $expected_revenue;
  262.         return $this;
  263.     }
  264.     public function getProbability(): ?int
  265.     {
  266.         return $this->probability;
  267.     }
  268.     public function setProbability(int $probability): self
  269.     {
  270.         $this->probability = $probability;
  271.         return $this;
  272.     }
  273.     public function getIdentifiantOdoo(): ?string
  274.     {
  275.         return $this->identifiant_odoo;
  276.     }
  277.     public function setIdentifiantOdoo(?string $identifiant_odoo): self
  278.     {
  279.         $this->identifiant_odoo = $identifiant_odoo;
  280.         return $this;
  281.     }
  282.     public function getDayOpen(): ?int
  283.     {
  284.         return $this->day_open;
  285.     }
  286.     public function setDayOpen(?int $day_open): self
  287.     {
  288.         $this->day_open = $day_open;
  289.         return $this;
  290.     }
  291.     public function getDayClose(): ?int
  292.     {
  293.         return $this->day_close;
  294.     }
  295.     public function setDayClose(?int $day_close): self
  296.     {
  297.         $this->day_close = $day_close;
  298.         return $this;
  299.     }
  300.     public function getUserIdOdoo(): ?int
  301.     {
  302.         return $this->user_id_odoo;
  303.     }
  304.     public function setUserIdOdoo(?int $user_id_odoo): self
  305.     {
  306.         $this->user_id_odoo = $user_id_odoo;
  307.         return $this;
  308.     }
  309.     public function getClientIdOdoo(): ?int
  310.     {
  311.         return $this->client_id_odoo;
  312.     }
  313.     public function setClientIdOdoo(?int $client_id_odoo): self
  314.     {
  315.         $this->client_id_odoo = $client_id_odoo;
  316.         return $this;
  317.     }
  318.     public function getLastOrganizedDatas(): ?\DateTimeInterface
  319.     {
  320.         return $this->last_organized_datas;
  321.     }
  322.     public function setLastOrganizedDatas(?\DateTimeInterface $last_organized_datas): self
  323.     {
  324.         $this->last_organized_datas = $last_organized_datas;
  325.         return $this;
  326.     }
  327. }