src/Entity/Network.php line 37

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Manager\CustomerManager;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Event\LifecycleEventArgs;
  7. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * Network
  13.  * @ORM\Table(name="network", indexes={
  14.  * 
  15.  *      @ORM\Index(name="idx_608487bc7e3c61f9", columns={"owner_id"}),
  16.  *      @ORM\Index(name="idx_608487bc9f2c3fab", columns={"zone_id"}),
  17.  *      @ORM\Index(name="idx_608487bc5373c966", columns={"country"}),
  18.  *      @ORM\Index(name="networkidx1", columns={"localization_long", "localization_lat"})
  19.  * 
  20.  * },
  21.  * 
  22.  * uniqueConstraints={
  23.  *        @ORM\UniqueConstraint(name="network_number_key", columns={"network_number", "deleted_at"}),
  24.  *        @ORM\UniqueConstraint(name="project_number_key", columns={"project_number"}),
  25.  *        @ORM\UniqueConstraint(name="network_name_key", columns={"name", "deleted_at"})
  26.  *      }
  27.  * 
  28.  * )
  29.  * @ORM\Entity(repositoryClass="App\Repository\NetworkRepository")
  30.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  31.  */
  32. class Network
  33. {
  34.     use SoftDeleteableEntity;
  35.     const REMOVE_ACTION 'remove';
  36.     const STATUS_PROJECT 'project';
  37.     const STATUS_NETWORK 'network';
  38.     const STATUSES = [
  39.         self::STATUS_PROJECT,
  40.         self::STATUS_NETWORK,
  41.     ];
  42.     const STATE_DEFINITION 'definition';
  43.     const STATE_SIZING 'sizing';
  44.     const STATE_NETWORK_DEVICES 'network_devices';
  45.     const STATE_CUSTOMER_DEVICES 'customer_devices';
  46.     const STATE_CONTRACT 'contract';
  47.     const STATE_CONSTRUCTION 'construction';
  48.     const STATE_FINAL_DECISION 'final_decision';
  49.     const STATE_VALIDATED 'validated';
  50.     const STATE_REJECTED 'rejected';
  51.     const STATE_GENERATION_CODE "generation_code";
  52.     const STATES = [
  53.         self::STATE_DEFINITION,
  54.         self::STATE_SIZING,
  55.         self::STATE_NETWORK_DEVICES,
  56.         self::STATE_CUSTOMER_DEVICES,
  57.         self::STATE_CONTRACT,
  58.         self::STATE_CONSTRUCTION,
  59.         self::STATE_FINAL_DECISION,
  60.         self::STATE_VALIDATED,
  61.         self::STATE_REJECTED,
  62.     ];
  63.     const FINAL_STATES = [
  64.         self::STATE_VALIDATED,
  65.         self::STATE_REJECTED,
  66.     ];
  67.     const ADMIN_STATES = [
  68.         self::STATE_NETWORK_DEVICES,
  69.         self::STATE_CUSTOMER_DEVICES,
  70.         self::STATE_CONTRACT,
  71.         self::STATE_CONSTRUCTION,
  72.         self::STATE_FINAL_DECISION,
  73.     ];
  74.     const TRASITIONS_HISTORIC = [
  75.         self::TRANSITION_VALIDATE_CONTRACT,
  76.         self::TRANSITION_VALIDATE_FINAL_DECISION
  77.     ];
  78.     const TRANSITION_VALIDATE_DEFINITION 'validate_definition';
  79.     const TRANSITION_REJECT_DEFINITION 'reject_definition';
  80.     const TRANSITION_VALIDATE_SIZING 'validate_sizing';
  81.     const TRANSITION_REJECT_SIZING 'reject_sizing';
  82.     const TRANSITION_VALIDATE_NETWORK_DEVICES 'validate_network_devices';
  83.     const TRANSITION_REJECT_NETWORK_DEVICES 'reject_network_devices';
  84.     const TRANSITION_VALIDATE_CUSTOMER_DEVICES 'validate_customer_devices';
  85.     const TRANSITION_REJECT_CUSTOMER_DEVICES 'reject_customer_devices';
  86.     const TRANSITION_VALIDATE_CONTRACT 'validate_contract';
  87.     const TRANSITION_REJECT_CONTRACT 'reject_contract';
  88.     const TRANSITION_REJECT_CONSTRUCTION 'reject_construction';
  89.     const TRANSITION_VALIDATE_FINAL_DECISION 'validate_final_decision';
  90.     const TRANSITION_REJECT_FINAL_DECISION 'reject_final_decision';
  91.     const TRANSITION_GENERATION_CODE 'generation_code';
  92.     const TRANSITIONS = [
  93.         self::TRANSITION_VALIDATE_DEFINITION,
  94.         self::TRANSITION_REJECT_DEFINITION,
  95.         self::TRANSITION_VALIDATE_SIZING,
  96.         self::TRANSITION_REJECT_SIZING,
  97.         self::TRANSITION_VALIDATE_NETWORK_DEVICES,
  98.         self::TRANSITION_REJECT_NETWORK_DEVICES,
  99.         self::TRANSITION_VALIDATE_CUSTOMER_DEVICES,
  100.         self::TRANSITION_REJECT_CUSTOMER_DEVICES,
  101.         self::TRANSITION_VALIDATE_CONTRACT,
  102.         self::TRANSITION_REJECT_CONTRACT,
  103.         self::TRANSITION_REJECT_CONSTRUCTION,
  104.         self::TRANSITION_VALIDATE_FINAL_DECISION,
  105.         self::TRANSITION_REJECT_FINAL_DECISION,
  106.         self::TRANSITION_GENERATION_CODE,
  107.     ];
  108.     const FINAL_TRANSITIONS = [
  109.         self::TRANSITION_REJECT_FINAL_DECISION,
  110.         self::TRANSITION_VALIDATE_FINAL_DECISION,
  111.     ];
  112.     /**
  113.      * @var int
  114.      *
  115.      * @ORM\Column(name="id", type="integer")
  116.      * @ORM\Id
  117.      * @ORM\GeneratedValue(strategy="SEQUENCE")
  118.      * @ORM\SequenceGenerator(sequenceName="network_id_seq", allocationSize=1, initialValue=1)
  119.      */
  120.     private $id;
  121.     /**
  122.      * @var string|null
  123.      *
  124.      * @ORM\Column(name="name", type="text", nullable=true)
  125.      */
  126.     private $name;
  127.     /**
  128.      * @var string|null
  129.      *
  130.      * @ORM\Column(name="description", type="text", nullable=true)
  131.      */
  132.     private $description;
  133.     /**
  134.      * @var string|null
  135.      *
  136.      * @ORM\Column(name="status", type="text", nullable=true)
  137.      */
  138.     private $status;
  139.     /**
  140.      * @var float|null
  141.      *
  142.      * @ORM\Column(name="localization_long", type="float", precision=10, scale=0, nullable=true)
  143.      */
  144.     private $localizationLong;
  145.     /**
  146.      * @var float|null
  147.      *
  148.      * @ORM\Column(name="localization_lat", type="float", precision=10, scale=0, nullable=true)
  149.      */
  150.     private $localizationLat;
  151.     /**
  152.      * @var string|null
  153.      *
  154.      * @ORM\Column(name="address", type="text", nullable=true)
  155.      */
  156.     private $address;
  157.     /**
  158.      * @var string|null
  159.      *
  160.      * @ORM\Column(name="quarter", type="text", nullable=true)
  161.      */
  162.     private $quarter;
  163.     /**
  164.      * @var string|null
  165.      *
  166.      * @ORM\Column(name="zip", type="text", nullable=true)
  167.      */
  168.     private $zip;
  169.     /**
  170.      * @var string|null
  171.      *
  172.      * @ORM\Column(name="city", type="text", nullable=true)
  173.      */
  174.     private $city;
  175.     /**
  176.      * @var \DateTime|null
  177.      *
  178.      * @ORM\Column(name="date_start_construction", type="datetimetz", nullable=true)
  179.      */
  180.     private $dateStartConstruction;
  181.     /**
  182.      * @var \DateTime|null
  183.      *
  184.      * @ORM\Column(name="date_start_service", type="datetimetz", nullable=true)
  185.      */
  186.     private $dateStartService;
  187.     /**
  188.      * @var \DateTime|null
  189.      *
  190.      * @ORM\Column(name="date_end_service", type="datetimetz", nullable=true)
  191.      */
  192.     private $dateEndService;
  193.     /**
  194.      * @var \DateTime|null
  195.      *
  196.      * @ORM\Column(name="date_creation", type="datetimetz", nullable=true)
  197.      */
  198.     private $dateCreation;
  199.     /**
  200.      * @var \DateTime
  201.      *
  202.      * @ORM\Column(name="date_update", type="datetimetz", nullable=true, options={"default": "CURRENT_TIMESTAMP"})
  203.      */
  204.     private $dateUpdate;
  205.     /**
  206.      * @var bool|null
  207.      *
  208.      * @ORM\Column(name="active", type="boolean", nullable=true)
  209.      */
  210.     private $active false;
  211.     /**
  212.      * @var bool|null
  213.      *
  214.      * @ORM\Column(name="check_updated", type="boolean", nullable=true)
  215.      */
  216.     private $checkUpdated false;
  217.     /**
  218.      * @var string|null
  219.      *
  220.      * @ORM\Column(name="ash_key", type="text", nullable=true)
  221.      */
  222.     private $ashKey;
  223.     /**
  224.      * @var string|null
  225.      *
  226.      * @ORM\Column(name="permutation_key", type="text", nullable=true)
  227.      */
  228.     private $permutationKey;
  229.     /**
  230.      * @var \App\Entity\NetworkDevice
  231.      *
  232.      * @ORM\OneToMany(targetEntity="App\Entity\NetworkDevice", mappedBy="network", cascade={"persist"})
  233.      */
  234.     private $devices;
  235.     /**
  236.      * @var #ArrayCollection
  237.      */
  238.     // private $deviceDeleted;
  239.     /**
  240.      * @var string|null
  241.      *
  242.      * @ORM\Column(name="workflow_state", type="string", length=255, nullable=true)
  243.      */
  244.     private $workflowState;
  245.     /**
  246.      * @var \App\Entity\Zone
  247.      *
  248.      * @ORM\ManyToOne(targetEntity="App\Entity\Zone")
  249.      * @ORM\JoinColumns({
  250.      *   @ORM\JoinColumn(onDelete="SET NULL", name="zone_id", referencedColumnName="id")
  251.      * })
  252.      */
  253.     private $zone;
  254.     /**
  255.      * @var \App\Entity\Users
  256.      *
  257.      * @ORM\ManyToOne(targetEntity="App\Entity\Users")
  258.      * @ORM\JoinColumns({
  259.      *   @ORM\JoinColumn(onDelete="SET NULL", name="owner_id", referencedColumnName="id")
  260.      * })
  261.      */
  262.     private $owner;
  263.     /**
  264.      * @var int|null
  265.      *
  266.      * @ORM\Column(name="project_number", type="integer", nullable=true)
  267.      */
  268.     private $projectNumber;
  269.     /**
  270.      * @var int|null
  271.      *
  272.      * @ORM\Column(name="prospect_number", type="integer", nullable=true)
  273.      */
  274.     private $prospectNumber;
  275.     /**
  276.      * @var int|null
  277.      *
  278.      * @ORM\Column(name="network_number", type="integer", nullable=true)
  279.      */
  280.     private $networkNumber;
  281.     /**
  282.      * @var float|null
  283.      *
  284.      * @ORM\Column(name="stake_localization_long", type="float", precision=10, scale=0, nullable=true)
  285.      */
  286.     private $stakeLocalizationLong;
  287.     /**
  288.      * @var float|null
  289.      *
  290.      * @ORM\Column(name="stake_localization_lat", type="float", precision=10, scale=0, nullable=true)
  291.      */
  292.     private $stakeLocalizationLat;
  293.     /**
  294.      * @var \App\Entity\Customer
  295.      *
  296.      * @ORM\OneToMany(targetEntity="App\Entity\Customer", mappedBy="network")
  297.      */
  298.     private $customers;
  299.     /**
  300.      * @var NetworkDevice
  301.      */
  302.     private $networkDevices;
  303.     /**
  304.      * @var int|null
  305.      *
  306.      * @ORM\Column(name="total_power", type="integer", nullable=true)
  307.      */
  308.     private $totalPower;
  309.     /**
  310.      * @var int|null
  311.      *
  312.      * @ORM\Column(name="total_storage_capacity", type="integer", nullable=true)
  313.      */
  314.     private $totalStorageCapacity;
  315.     /**
  316.      * @var int|null
  317.      *
  318.      * @ORM\Column(name="total_voltage", type="integer", nullable=true)
  319.      */
  320.     private $totalVoltage;
  321.     /**
  322.      * @var int|null
  323.      *
  324.      * @ORM\Column(name="total_cost", type="integer", nullable=true)
  325.      */
  326.     private $totalCost;
  327.     /**
  328.      * @var int|null
  329.      *
  330.      * @ORM\Column(name="total_wire_length", type="integer", nullable=true)
  331.      */
  332.     private $totalWireLength;
  333.     /**
  334.      * @var int|null
  335.      *
  336.      * @ORM\Column(name="total_max_power_consumption", type="integer", nullable=true)
  337.      */
  338.     private $totalMaxPowerConsumption;
  339.     /**
  340.      * @var int|null
  341.      *
  342.      * @ORM\Column(name="total_consumption_day", type="integer", nullable=true)
  343.      */
  344.     private $totalConsumptionDay;
  345.     /**
  346.      * @var \App\Entity\CustomerOperations
  347.      *
  348.      * @ORM\OneToMany(targetEntity="App\Entity\CustomerOperations", mappedBy="network")
  349.      */
  350.     private $customerOperations;
  351.     /**
  352.      * @var float|null
  353.      *
  354.      * @ORM\Column(name="commission_percentage", type="float", precision=10, scale=0, nullable=true)
  355.      */
  356.     private $commissionPercentage;
  357.     /**
  358.      * @var \App\Entity\TensionRecord
  359.      *
  360.      * @ORM\OneToMany(targetEntity="App\Entity\TensionRecord", mappedBy="network")
  361.      */
  362.     private $tensionRecords;
  363.     /**
  364.      * @var \App\Entity\ReloadRecord
  365.      *
  366.      * @ORM\OneToMany(targetEntity="App\Entity\ReloadRecord", mappedBy="network")
  367.      */
  368.     private $reloadRecords;
  369.     /**
  370.      * @var \App\Entity\AggTensionRecord
  371.      *
  372.      * @ORM\OneToMany(targetEntity="App\Entity\AggTensionRecord", mappedBy="network")
  373.      */
  374.     private $aggTensionRecords;
  375.     /**
  376.      * @var \App\Entity\AggTransactionRecord
  377.      *
  378.      * @ORM\OneToMany(targetEntity="App\Entity\AggTransactionRecord", mappedBy="network")
  379.      */
  380.     private $aggTransactionRecords;
  381.     /**
  382.      * @var \App\Entity\Intervention
  383.      *
  384.      * @ORM\OneToMany(targetEntity="App\Entity\Intervention", mappedBy="network")
  385.      */
  386.     private $interventions;
  387.     /**
  388.      * @var array|null
  389.      *
  390.      * @ORM\Column(name="commissions", type="array", nullable=true, options={"default"="a:0:{}"})
  391.      */
  392.     private $commissions 'a:0:{}';
  393.     /**
  394.      * @var \App\Entity\Commission
  395.      *
  396.      * @ORM\OneToMany(targetEntity="App\Entity\Commission", mappedBy="network", cascade={"persist"}, orphanRemoval=true)
  397.      */
  398.     private $commissionEntrepreneurs;
  399.     /**
  400.      * @var array|null
  401.      *
  402.      * @ORM\Column(name="nano_entrepreneur", type="array", nullable=true, options={"default"="a:0:{}"})
  403.      */
  404.     private $nanoEntrepreneur 'a:0:{}';
  405.     /**
  406.      * @ORM\OneToMany(targetEntity="App\Entity\NanoEntrepreneur", mappedBy="network", cascade={"persist"}, orphanRemoval=true)
  407.      */
  408.     private $nanoEntrepreneurs;
  409.     // /**
  410.     //  * @var \DateTime|null
  411.     //  *
  412.     //  * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
  413.     //  */
  414.     // private $deletedAt;
  415.     /**
  416.      * @var \App\Entity\NetworkCustomerHistoric
  417.      *
  418.      * @ORM\OneToMany(targetEntity="App\Entity\NetworkCustomerHistoric", mappedBy="network")
  419.      */
  420.     private $networkCustomerHistoric;
  421.     /**
  422.      * @var string|null
  423.      *
  424.      * @ORM\Column(name="comment", type="string", length=255, nullable=true)
  425.      */
  426.     private $comment;
  427.     /**
  428.      * @var string|null
  429.      *
  430.      * @ORM\Column(name="cryptage", type="string", length=10, nullable=true)
  431.      */
  432.     private $cryptage;
  433.     /**
  434.      * @var int
  435.      */
  436.     private $puissance;
  437.     /**
  438.      * @var \App\Entity\CommonCountry
  439.      *
  440.      * @ORM\ManyToOne(targetEntity="App\Entity\CommonCountry")
  441.      * @ORM\JoinColumns({
  442.      *   @ORM\JoinColumn(onDelete="SET NULL", name="country", referencedColumnName="id")
  443.      * })
  444.      */
  445.     private $country;
  446.     /**
  447.      * @var int
  448.      */
  449.     private $capaciteStockage;
  450.     /**
  451.      * @var \App\Entity\GeneratedCode
  452.      *
  453.      * @ORM\OneToMany(targetEntity="App\Entity\GeneratedCode", mappedBy="network")
  454.      */
  455.     private $generatedCodes;
  456.     /**
  457.      * @var \Doctrine\Common\Collections\Collection
  458.      */
  459.     private $generatedCode;
  460.     /**
  461.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="nanoReseau")
  462.      */
  463.     private $stocks;
  464.     /**
  465.      * Network constructor.
  466.      */
  467.     public function __construct()
  468.     {
  469.         $this->dateUpdate $this->dateUpdate ?? new \DateTime();
  470.         $this->status self::STATUS_PROJECT;
  471.         $this->devices = new ArrayCollection();
  472.         $this->workflowState self::STATE_DEFINITION;
  473.         $this->customers = new ArrayCollection();
  474.         $this->active false;
  475.         $this->customerOperations = new ArrayCollection();
  476.         $this->tensionRecords = new ArrayCollection();
  477.         $this->reloadRecords = new ArrayCollection();
  478.         $this->aggTensionRecords = new ArrayCollection();
  479.         $this->aggTransactionRecords = new ArrayCollection();
  480.         $this->interventions = new ArrayCollection();
  481.         $this->commissions serialize([]);
  482.         $this->nanoEntrepreneurs serialize([]);
  483.         $this->nanoEntrepreneurs = new ArrayCollection();
  484.         $this->commissionEntrepreneurs = new ArrayCollection();
  485.         $this->stocks = new ArrayCollection();
  486.     }
  487.     /**
  488.      * Get id
  489.      *
  490.      * @return integer
  491.      */
  492.     public function getId()
  493.     {
  494.         return $this->id;
  495.     }
  496.     public function getMarking()
  497.     {
  498.     }
  499.     public function setMarking()
  500.     {
  501.     }
  502.     // public function getDeletedAt()
  503.     // {
  504.     //     return $this->deletedAt;
  505.     // }
  506.     // public function setDeletedAt(\DateTime $deletedAt)
  507.     // {
  508.     //     $this->deletedAt = $deletedAt;
  509.     // }
  510.     /**
  511.      * Set name
  512.      *
  513.      * @param string $name
  514.      *
  515.      * @return Network
  516.      */
  517.     public function setName($name)
  518.     {
  519.         $this->name $name;
  520.         return $this;
  521.     }
  522.     /**
  523.      * Get name
  524.      *
  525.      * @return string
  526.      */
  527.     public function getName()
  528.     {
  529.         return $this->name;
  530.     }
  531.     /**
  532.      * Set description
  533.      *
  534.      * @param string $description
  535.      *
  536.      * @return Network
  537.      */
  538.     public function setDescription($description)
  539.     {
  540.         $this->description $description;
  541.         return $this;
  542.     }
  543.     /**
  544.      * Get description
  545.      *
  546.      * @return string
  547.      */
  548.     public function getDescription()
  549.     {
  550.         return $this->description;
  551.     }
  552.     /**
  553.      * Set status
  554.      *
  555.      * @param string $status
  556.      *
  557.      * @return Network
  558.      */
  559.     public function setStatus($status)
  560.     {
  561.         $this->status $status;
  562.         return $this;
  563.     }
  564.     /**
  565.      * Get status
  566.      *
  567.      * @return string
  568.      */
  569.     public function getStatus()
  570.     {
  571.         return $this->status;
  572.     }
  573.     /**
  574.      * Set localizationLong
  575.      *
  576.      * @param float $localizationLong
  577.      *
  578.      * @return Network
  579.      */
  580.     public function setLocalizationLong($localizationLong)
  581.     {
  582.         $this->localizationLong $localizationLong;
  583.         return $this;
  584.     }
  585.     /**
  586.      * Get localizationLong
  587.      *
  588.      * @return float
  589.      */
  590.     public function getLocalizationLong()
  591.     {
  592.         return $this->localizationLong;
  593.     }
  594.     /**
  595.      * Set localizationLat
  596.      *
  597.      * @param float $localizationLat
  598.      *
  599.      * @return Network
  600.      */
  601.     public function setLocalizationLat($localizationLat)
  602.     {
  603.         $this->localizationLat $localizationLat;
  604.         return $this;
  605.     }
  606.     /**
  607.      * Get localizationLat
  608.      *
  609.      * @return float
  610.      */
  611.     public function getLocalizationLat()
  612.     {
  613.         return $this->localizationLat;
  614.     }
  615.     /**
  616.      * @return string
  617.      */
  618.     public function getCoordinates()
  619.     {
  620.         return $this->localizationLat && $this->localizationLong
  621.             $this->localizationLat ', ' $this->localizationLong
  622.             'N/A';
  623.     }
  624.     /**
  625.      * @return float
  626.      */
  627.     public function getStakeLocalizationLong()
  628.     {
  629.         return $this->stakeLocalizationLong;
  630.     }
  631.     /**
  632.      * @param float $stakeLocalizationLong
  633.      * @return Network
  634.      */
  635.     public function setStakeLocalizationLong($stakeLocalizationLong)
  636.     {
  637.         $this->stakeLocalizationLong $stakeLocalizationLong;
  638.         return $this;
  639.     }
  640.     /**
  641.      * @return float
  642.      */
  643.     public function getStakeLocalizationLat()
  644.     {
  645.         return $this->stakeLocalizationLat;
  646.     }
  647.     /**
  648.      * @param float $stakeLocalizationLat
  649.      * @return Network
  650.      */
  651.     public function setStakeLocalizationLat($stakeLocalizationLat)
  652.     {
  653.         $this->stakeLocalizationLat $stakeLocalizationLat;
  654.         return $this;
  655.     }
  656.     /**
  657.      * @return string
  658.      */
  659.     public function getstakeCoordinates()
  660.     {
  661.         return $this->stakeLocalizationLat && $this->stakeLocalizationLong
  662.             $this->stakeLocalizationLat ', ' $this->stakeLocalizationLong
  663.             'N/A';
  664.     }
  665.     /**
  666.      * Set address
  667.      *
  668.      * @param string $address
  669.      *
  670.      * @return Network
  671.      */
  672.     public function setAddress($address)
  673.     {
  674.         $this->address $address;
  675.         return $this;
  676.     }
  677.     /**
  678.      * Get address
  679.      *
  680.      * @return string
  681.      */
  682.     public function getAddress()
  683.     {
  684.         return $this->address;
  685.     }
  686.     /**
  687.      * Set quarter
  688.      *
  689.      * @param string $quarter
  690.      *
  691.      * @return Network
  692.      */
  693.     public function setQuarter($quarter)
  694.     {
  695.         $this->quarter $quarter;
  696.         return $this;
  697.     }
  698.     /**
  699.      * Get quarter
  700.      *
  701.      * @return string
  702.      */
  703.     public function getQuarter()
  704.     {
  705.         return $this->quarter;
  706.     }
  707.     /**
  708.      * Set zip
  709.      *
  710.      * @param string $zip
  711.      *
  712.      * @return Network
  713.      */
  714.     public function setZip($zip)
  715.     {
  716.         $this->zip $zip;
  717.         return $this;
  718.     }
  719.     /**
  720.      * Get zip
  721.      *
  722.      * @return string
  723.      */
  724.     public function getZip()
  725.     {
  726.         return $this->zip;
  727.     }
  728.     /**
  729.      * Set city
  730.      *
  731.      * @param string $city
  732.      *
  733.      * @return Network
  734.      */
  735.     public function setCity($city)
  736.     {
  737.         $this->city $city;
  738.         return $this;
  739.     }
  740.     /**
  741.      * Get city
  742.      *
  743.      * @return string
  744.      */
  745.     public function getCity()
  746.     {
  747.         return $this->city;
  748.     }
  749.     /**
  750.      * Set dateStartConstruction
  751.      *
  752.      * @param \DateTime $dateStartConstruction
  753.      *
  754.      * @return Network
  755.      */
  756.     public function setDateStartConstruction(\DateTime $dateStartConstruction)
  757.     {
  758.         $this->dateStartConstruction $dateStartConstruction;
  759.         return $this;
  760.     }
  761.     /**
  762.      * Get dateStartConstruction
  763.      *
  764.      * @return \DateTime
  765.      */
  766.     public function getDateStartConstruction()
  767.     {
  768.         return $this->dateStartConstruction;
  769.     }
  770.     /**
  771.      * Set dateStartService
  772.      *
  773.      * @param \DateTime $dateStartService
  774.      *
  775.      * @return Network
  776.      */
  777.     public function setDateStartService(\DateTime $dateStartService)
  778.     {
  779.         $this->dateStartService $dateStartService;
  780.         return $this;
  781.     }
  782.     /**
  783.      * Get dateStartService
  784.      *
  785.      * @return \DateTime
  786.      */
  787.     public function getDateStartService()
  788.     {
  789.         return $this->dateStartService;
  790.     }
  791.     /**
  792.      * Set dateEndService
  793.      *
  794.      * @param \DateTime $dateEndService
  795.      *
  796.      * @return Network
  797.      */
  798.     public function setDateEndService(\DateTime $dateEndService)
  799.     {
  800.         $this->dateEndService $dateEndService;
  801.         return $this;
  802.     }
  803.     /**
  804.      * Get dateEndService
  805.      *
  806.      * @return \DateTime
  807.      */
  808.     public function getDateEndService()
  809.     {
  810.         return $this->dateEndService;
  811.     }
  812.     /**
  813.      * Set dateCreation
  814.      *
  815.      * @param \DateTime $dateCreation
  816.      *
  817.      * @return Network
  818.      */
  819.     public function setDateCreation(\DateTime $dateCreation)
  820.     {
  821.         $this->dateCreation $dateCreation;
  822.         return $this;
  823.     }
  824.     /**
  825.      * Get dateCreation
  826.      *
  827.      * @return \DateTime
  828.      */
  829.     public function getDateCreation()
  830.     {
  831.         return $this->dateCreation;
  832.     }
  833.     /**
  834.      * Set dateUpdate
  835.      *
  836.      * @param \DateTime $dateUpdate
  837.      *
  838.      * @return Network
  839.      */
  840.     public function setDateUpdate(\DateTime $dateUpdate)
  841.     {
  842.         $this->dateUpdate $dateUpdate;
  843.         return $this;
  844.     }
  845.     /**
  846.      * Get dateUpdate
  847.      *
  848.      * @return \DateTime
  849.      */
  850.     public function getDateUpdate()
  851.     {
  852.         return $this->dateUpdate;
  853.     }
  854.     /**
  855.      * Set active
  856.      *
  857.      * @param boolean $active
  858.      *
  859.      * @return Network
  860.      */
  861.     public function setActive($active)
  862.     {
  863.         $this->active $active;
  864.         return $this;
  865.     }
  866.     /**
  867.      * Get active
  868.      *
  869.      * @return boolean
  870.      */
  871.     public function getActive()
  872.     {
  873.         return $this->active;
  874.     }
  875.     public function setCheckUpdated($checkUpdated)
  876.     {
  877.         $this->checkUpdated $checkUpdated;
  878.         return $this;
  879.     }
  880.     public function getCheckUpdated()
  881.     {
  882.         return $this->checkUpdated;
  883.     }
  884.     /**
  885.      * Set country
  886.      *
  887.      * @param CommonCountry $country
  888.      *
  889.      * @return Network
  890.      */
  891.     public function setCountry(CommonCountry $country null)
  892.     {
  893.         $this->country $country;
  894.         return $this;
  895.     }
  896.     /**
  897.      * Get country
  898.      *
  899.      * @return CommonCountry
  900.      */
  901.     public function getCountry()
  902.     {
  903.         return $this->country;
  904.     }
  905.     /**
  906.      * @return string
  907.      */
  908.     public function getAshKey()
  909.     {
  910.         return $this->ashKey;
  911.     }
  912.     /**
  913.      * @param string $ashKey
  914.      * @return Network
  915.      */
  916.     public function setAshKey($ashKey)
  917.     {
  918.         $this->ashKey $ashKey;
  919.         return $this;
  920.     }
  921.     /**
  922.      * @return string
  923.      */
  924.     public function getPermutationKey()
  925.     {
  926.         return $this->permutationKey;
  927.     }
  928.     /**
  929.      * @param string $permutationKey
  930.      * @return Network
  931.      */
  932.     public function setPermutationKey($permutationKey)
  933.     {
  934.         $this->permutationKey $permutationKey;
  935.         return $this;
  936.     }
  937.     /**
  938.      * @return bool
  939.      */
  940.     public function isProject()
  941.     {
  942.         return $this->status === self::STATUS_PROJECT;
  943.     }
  944.     /**
  945.      * @return bool
  946.      */
  947.     public function isNetwork()
  948.     {
  949.         return $this->status === self::STATUS_NETWORK;
  950.     }
  951.     /**
  952.      * @param NetworkDevice $networkDevice
  953.      * @return Network
  954.      */
  955.     public function addDevices(NetworkDevice $networkDevice)
  956.     {
  957.         if (!$this->devices->contains($networkDevice)) {
  958.             $this->devices->add($networkDevice);
  959.             $networkDevice->setNetwork($this);
  960.         }
  961.         return $this;
  962.     }
  963.     /**
  964.      * @param NetworkDevice $networkDevice
  965.      * @return Network
  966.      */
  967.     public function removeDevices(NetworkDevice $networkDevice)
  968.     {
  969.         if ($this->devices->contains($networkDevice)) {
  970.             $this->devices->removeElement($networkDevice);
  971.             $networkDevice->setNetwork(null);
  972.         }
  973.         return $this;
  974.     }
  975.     /**
  976.      * @param NetworkDevice $networkDevice
  977.      * @return Network
  978.      */
  979.     public function setDevice(NetworkDevice $networkDevice)
  980.     {
  981.         return $this->addDevices($networkDevice);
  982.     }
  983.     /**
  984.      * @return ArrayCollection
  985.      */
  986.     public function getDevices()
  987.     {
  988.         //return $this->devices;
  989.         $data $this->devices->filter(
  990.             function ($entry) {
  991.                 return is_null($entry->getDateDeletion());
  992.             }
  993.         )->getValues();
  994.         return new ArrayCollection($data);
  995.     }
  996.     public function getDeviceDeleted()
  997.     {
  998.         return $this->devices->filter(
  999.             function ($entry) {
  1000.                 return !is_null($entry->getDateDeletion()) || !is_null($entry->getUserUpdated());
  1001.             }
  1002.         );
  1003.     }
  1004.     /**
  1005.      * @return string
  1006.      */
  1007.     public function getWorkflowState()
  1008.     {
  1009.         return $this->workflowState;
  1010.     }
  1011.     /**
  1012.      * @param string $workflowState
  1013.      * @return Network
  1014.      */
  1015.     public function setWorkflowState($workflowState)
  1016.     {
  1017.         $this->workflowState $workflowState;
  1018.         return $this;
  1019.     }
  1020.     /**
  1021.      * @return Zone
  1022.      */
  1023.     public function getZone()
  1024.     {
  1025.         return $this->zone;
  1026.     }
  1027.     /**
  1028.      * @param Zone $zone
  1029.      * @return Network
  1030.      */
  1031.     public function setZone(Zone $zone null)
  1032.     {
  1033.         $this->zone $zone;
  1034.         return $this;
  1035.     }
  1036.     /**
  1037.      * @return Users
  1038.      */
  1039.     public function getOwner()
  1040.     {
  1041.         return $this->owner;
  1042.     }
  1043.     /**
  1044.      * @param Users $owner
  1045.      * @return Network
  1046.      */
  1047.     public function setOwner(Users $owner null)
  1048.     {
  1049.         $this->owner $owner;
  1050.         return $this;
  1051.     }
  1052.     /**
  1053.      * @return int
  1054.      */
  1055.     public function getProjectNumber()
  1056.     {
  1057.         return $this->projectNumber;
  1058.     }
  1059.     /**
  1060.      * @param int $projectNumber
  1061.      * @return Network
  1062.      */
  1063.     public function setProjectNumber($projectNumber)
  1064.     {
  1065.         $this->projectNumber $projectNumber;
  1066.         return $this;
  1067.     }
  1068.     /**
  1069.      * @return int
  1070.      */
  1071.     public function getNetworkNumber()
  1072.     {
  1073.         return $this->networkNumber;
  1074.     }
  1075.     /**
  1076.      * @param int $networkNumber
  1077.      * @return Network
  1078.      */
  1079.     public function setNetworkNumber($networkNumber)
  1080.     {
  1081.         $this->networkNumber $networkNumber;
  1082.         return $this;
  1083.     }
  1084.     /**
  1085.      * @return ArrayCollection
  1086.      */
  1087.     public function getCustomers()
  1088.     {
  1089.         return $this->customers;
  1090.     }
  1091.     /**
  1092.      * @param Customer $customer
  1093.      * @return Network
  1094.      */
  1095.     public function setCustomers(Customer $customer)
  1096.     {
  1097.         return $this->addCustomers($customer);
  1098.     }
  1099.     /**
  1100.      * @param Customer $customer
  1101.      * @return Network
  1102.      */
  1103.     public function addCustomers(Customer $customer)
  1104.     {
  1105.         /*if (!$this->customers->contains($customer)) {
  1106.             $this->customers->add($customer);
  1107.             $customer
  1108.                 ->setNetwork($this)
  1109.                 ->setSlotNumber($this->customers->count() + 1)
  1110.             ;
  1111.         }*/
  1112.         $slots = [123456];
  1113.         //dump($this->customers->contains($customer));
  1114.         if (!$this->customers->contains($customer)) {
  1115.             foreach ($this->customers as $cust) {
  1116.                 unset($slots[$cust->getSlotNumber() - 1]);
  1117.             }
  1118.             $this->customers->add($customer);
  1119.             $customer
  1120.                 ->setNetwork($this)
  1121.                 //->setSlotNumber(reset($slots))
  1122.             ;
  1123.         }
  1124.         return $this;
  1125.     }
  1126.     /**
  1127.      * @param Customer $customer
  1128.      * @return Network
  1129.      */
  1130.     public function removeCustomers(Customer $customer)
  1131.     {
  1132.         if ($this->customers->contains($customer)) {
  1133.             $this->customers->removeElement($customer);
  1134.             $customer
  1135.                 ->setNetwork(null)
  1136.                 ->setStatus(Customer::STATUS_PROSPECT)
  1137.                 ->setDateJoinNetwork(null)
  1138.                 //->setSlotNumber(null)
  1139.                 ->setCustomNumber(null);
  1140.         }
  1141.         return $this;
  1142.     }
  1143.     /**
  1144.      * @return Network
  1145.      */
  1146.     public function removeAllCustomers()
  1147.     {
  1148.         /** @var Customer $customer */
  1149.         foreach ($this->customers as $customer) {
  1150.             if (is_object($customer)) {
  1151.                 $this->removeCustomers($customer);
  1152.             }
  1153.         }
  1154.         return $this;
  1155.     }
  1156.     /**
  1157.      * @return int
  1158.      */
  1159.     public function getTotalPower()
  1160.     {
  1161.         return $this->totalPower;
  1162.     }
  1163.     /**
  1164.      * @param int $totalPower
  1165.      * @return Network
  1166.      */
  1167.     public function setTotalPower($totalPower)
  1168.     {
  1169.         $this->totalPower $totalPower;
  1170.         return $this;
  1171.     }
  1172.     /**
  1173.      * @return int
  1174.      */
  1175.     public function getTotalStorageCapacity()
  1176.     {
  1177.         return $this->totalStorageCapacity;
  1178.     }
  1179.     /**
  1180.      * @param int $totalStorageCapacity
  1181.      * @return Network
  1182.      */
  1183.     public function setTotalStorageCapacity($totalStorageCapacity)
  1184.     {
  1185.         $this->totalStorageCapacity $totalStorageCapacity;
  1186.         return $this;
  1187.     }
  1188.     /**
  1189.      * @return int
  1190.      */
  1191.     public function getTotalVoltage()
  1192.     {
  1193.         return $this->totalVoltage;
  1194.     }
  1195.     /**
  1196.      * @param int $totalVoltage
  1197.      * @return Network
  1198.      */
  1199.     public function setTotalVoltage($totalVoltage)
  1200.     {
  1201.         $this->totalVoltage $totalVoltage;
  1202.         return $this;
  1203.     }
  1204.     /**
  1205.      * @return int
  1206.      */
  1207.     public function getTotalCost()
  1208.     {
  1209.         return $this->totalCost;
  1210.     }
  1211.     /**
  1212.      * @param int $totalCost
  1213.      * @return Network
  1214.      */
  1215.     public function setTotalCost($totalCost)
  1216.     {
  1217.         $this->totalCost $totalCost;
  1218.         return $this;
  1219.     }
  1220.     /**
  1221.      * @return int
  1222.      */
  1223.     public function getTotalWireLength()
  1224.     {
  1225.         return $this->totalWireLength;
  1226.     }
  1227.     /**
  1228.      * @param int $totalWireLength
  1229.      * @return Network
  1230.      */
  1231.     public function setTotalWireLength($totalWireLength)
  1232.     {
  1233.         $this->totalWireLength $totalWireLength;
  1234.         return $this;
  1235.     }
  1236.     /**
  1237.      * @return int
  1238.      */
  1239.     public function getTotalMaxPowerConsumption()
  1240.     {
  1241.         return $this->totalMaxPowerConsumption;
  1242.     }
  1243.     /**
  1244.      * @param int $totalMaxPowerConsumption
  1245.      * @return Network
  1246.      */
  1247.     public function setTotalMaxPowerConsumption($totalMaxPowerConsumption)
  1248.     {
  1249.         $this->totalMaxPowerConsumption $totalMaxPowerConsumption;
  1250.         return $this;
  1251.     }
  1252.     /**
  1253.      * @return int
  1254.      */
  1255.     public function getTotalConsumptionDay()
  1256.     {
  1257.         return $this->totalConsumptionDay;
  1258.     }
  1259.     /**
  1260.      * @param int $totalConsumptionDay
  1261.      * @return Network
  1262.      */
  1263.     public function setTotalConsumptionDay($totalConsumptionDay)
  1264.     {
  1265.         $this->totalConsumptionDay $totalConsumptionDay;
  1266.         return $this;
  1267.     }
  1268.     /**
  1269.      * @return ArrayCollection
  1270.      */
  1271.     public function getCustomerOperations()
  1272.     {
  1273.         return $this->customerOperations;
  1274.     }
  1275.     /**
  1276.      * @param ArrayCollection $customerOperations
  1277.      * @return Network
  1278.      */
  1279.     public function setCustomerOperations($customerOperations)
  1280.     {
  1281.         $this->customerOperations $customerOperations;
  1282.         return $this;
  1283.     }
  1284.     /**
  1285.      * @param CustomerOperations $customerOperations
  1286.      * @return Network
  1287.      */
  1288.     public function addCustomerOperations(CustomerOperations $customerOperations)
  1289.     {
  1290.         if (!$this->customerOperations->contains($customerOperations)) {
  1291.             $this->customerOperations->add($customerOperations);
  1292.             $customerOperations->setNetwork($this);
  1293.         }
  1294.         return $this;
  1295.     }
  1296.     /**
  1297.      * @param CustomerOperations $customerOperations
  1298.      * @return Network
  1299.      */
  1300.     public function removeCustomerOperations(CustomerOperations $customerOperations)
  1301.     {
  1302.         if ($this->customerOperations->contains($customerOperations)) {
  1303.             $this->customerOperations->removeElement($customerOperations);
  1304.             $customerOperations->setNetwork(null);
  1305.         }
  1306.         return $this;
  1307.     }
  1308.     /**
  1309.      * @return float
  1310.      */
  1311.     public function getCommissionPercentage()
  1312.     {
  1313.         return $this->commissionPercentage;
  1314.     }
  1315.     /**
  1316.      * @param float $commissionPercentage
  1317.      * @return Network
  1318.      */
  1319.     public function setCommissionPercentage($commissionPercentage)
  1320.     {
  1321.         $this->commissionPercentage $commissionPercentage;
  1322.         return $this;
  1323.     }
  1324.     /**
  1325.      * @return TensionRecord
  1326.      */
  1327.     public function getTensionRecords()
  1328.     {
  1329.         return $this->tensionRecords;
  1330.     }
  1331.     /**
  1332.      * @param TensionRecord $tensionRecord
  1333.      * @return $this
  1334.      */
  1335.     public function addTensionRecords(TensionRecord $tensionRecord)
  1336.     {
  1337.         if (!$this->tensionRecords->contains($tensionRecord)) {
  1338.             $this->tensionRecords->add($tensionRecord);
  1339.             $tensionRecord->setNetwork($this);
  1340.         }
  1341.         return $this;
  1342.     }
  1343.     /**
  1344.      * @param TensionRecord $tensionRecords
  1345.      * @return Network
  1346.      */
  1347.     public function setTensionRecords(TensionRecord $tensionRecords)
  1348.     {
  1349.         return $this->addTensionRecords($tensionRecords);
  1350.     }
  1351.     /**
  1352.      * @return ReloadRecord
  1353.      */
  1354.     public function getReloadRecords()
  1355.     {
  1356.         return $this->reloadRecords;
  1357.     }
  1358.     /**
  1359.      * @param ReloadRecord $reloadRecords
  1360.      * @return Network
  1361.      */
  1362.     public function addReloadRecords(ReloadRecord $reloadRecords)
  1363.     {
  1364.         if (!$this->reloadRecords->contains($reloadRecords)) {
  1365.             $this->reloadRecords->add($reloadRecords);
  1366.             $reloadRecords->setNetwork($this);
  1367.         }
  1368.         return $this;
  1369.     }
  1370.     /**
  1371.      * @param ReloadRecord $reloadRecords
  1372.      * @return Network
  1373.      */
  1374.     public function setReloadRecords(ReloadRecord $reloadRecords)
  1375.     {
  1376.         return $this->addReloadRecords($reloadRecords);
  1377.     }
  1378.     /**
  1379.      * @return Collection
  1380.      */
  1381.     public function getAggTensionRecords(): Collection
  1382.     {
  1383.         return $this->aggTensionRecords;
  1384.     }
  1385.     /**
  1386.      * @return Collection
  1387.      */
  1388.     public function getAggTransactionRecords(): Collection
  1389.     {
  1390.         return $this->aggTransactionRecords;
  1391.     }
  1392.     /**
  1393.      * @return Collection
  1394.      */
  1395.     public function getInterventions(): Collection
  1396.     {
  1397.         return $this->interventions;
  1398.     }
  1399.     /**
  1400.      * @param Intervention $intervention
  1401.      * @return $this
  1402.      */
  1403.     public function addInterventions(Intervention $intervention)
  1404.     {
  1405.         if (!$this->interventions->contains($intervention)) {
  1406.             $this->interventions->add($intervention);
  1407.             $intervention->setNetwork($this);
  1408.         }
  1409.         return $this;
  1410.     }
  1411.     /**
  1412.      * @return string
  1413.      */
  1414.     public function getNetworkNumberAndOwnerName()
  1415.     {
  1416.         return $this->getNetworkNumber() . ' - ' $this->getOwner();
  1417.     }
  1418.     /**
  1419.      * @return string
  1420.      */
  1421.     public function __toString()
  1422.     {
  1423.         return (string) $this->name;
  1424.     }
  1425.     /**
  1426.      * @param LifecycleEventArgs $args
  1427.      * @throws \Doctrine\ORM\ORMException
  1428.      * @throws \Doctrine\ORM\OptimisticLockException
  1429.      */
  1430.     public function turnProjectToNetwork(LifecycleEventArgs $args)
  1431.     {
  1432.         /** @var Network $network */
  1433.         $network $args->getObject();
  1434.         $em $args->getEntityManager();
  1435.         if (
  1436.             $network->getDateStartService() !== null
  1437.             && $network->getDateStartService() <= new \DateTime()
  1438.             && $network->getWorkflowState() === self::STATE_VALIDATED
  1439.         ) {
  1440.             $this->setStatus(self::STATUS_NETWORK);
  1441.             /** @var Customer $customer */
  1442.             foreach ($network->getCustomers() as $customer) {
  1443.                 if ($customer->isAllowedToBecomeAClient()) {
  1444.                     $customer->setStatus(Customer::STATUS_CLIENT);
  1445.                     $em->persist($customer);
  1446.                     $em->flush();
  1447.                 }
  1448.             }
  1449.         }
  1450.     }
  1451.     /**
  1452.      * @param LifecycleEventArgs $args
  1453.      * @throws \Doctrine\ORM\ORMException
  1454.      * @throws \Doctrine\ORM\OptimisticLockException
  1455.      */
  1456.     public function turnClientToProspect(LifecycleEventArgs $args)
  1457.     {
  1458.         /** @var Network $network */
  1459.         $network $args->getObject();
  1460.         $em $args->getEntityManager();
  1461.         foreach ($network->getCustomers() as $customer) {
  1462.             $customer->setDateJoinNetwork(null);
  1463.             $customer->setNetwork(null);
  1464.             $customer->setCustomNumber(null);
  1465.             $customer->setStatus(Customer::STATUS_PROSPECT);
  1466.             $customer->setCreator($network->getOwner());
  1467.             $customer->setWorkflowState(Customer::STATE_VALIDATED);
  1468.             if (!$customer->isBalancePositive()) {
  1469.                 $customer->setBalance(0);
  1470.             }
  1471.             $em->persist($customer);
  1472.         }
  1473.         $em->flush();
  1474.     }
  1475.     /**
  1476.      * @return array
  1477.      */
  1478.     public function getCommissions()
  1479.     {
  1480.         if (is_string($this->commissions)) {
  1481.             return unserialize($this->commissions);
  1482.         }
  1483.         return ($this->commissions);
  1484.     }
  1485.     /**
  1486.      * @param array $commissions
  1487.      * @return $commissions
  1488.      */
  1489.     public function setCommissions($commissions)
  1490.     {
  1491.         $this->commissions serialize($commissions);
  1492.         return $this;
  1493.     }
  1494.     /**
  1495.      * @return \NetworkCustomerHistoric
  1496.      */
  1497.     public function getNetworkCustomerHistoric()
  1498.     {
  1499.         return $this->networkCustomerHistoric;
  1500.     }
  1501.     /**
  1502.      * @param NetworkCustomerHistoric $networkCustomerHistoric
  1503.      */
  1504.     public function setNetworkCustomerHistoric(NetworkCustomerHistoric $networkCustomerHistoric): void
  1505.     {
  1506.         $this->networkCustomerHistoric $networkCustomerHistoric;
  1507.     }
  1508.     /**
  1509.      * @return array
  1510.      */
  1511.     public function getNanoEntrepreneur()
  1512.     {
  1513.         if (is_string($this->nanoEntrepreneurs)) {
  1514.             return unserialize($this->nanoEntrepreneurs);
  1515.         }
  1516.         return ($this->nanoEntrepreneurs);
  1517.     }
  1518.     /**
  1519.      * @param array $nanoEntrepreneur
  1520.      */
  1521.     /*    public function setNanoEntrepreneur(array $nanoEntrepreneur)
  1522.     {
  1523.         $this->nanoEntrepreneur = serialize($nanoEntrepreneur);
  1524.         return $this;
  1525.     }*/
  1526.     /**
  1527.      * @return string
  1528.      */
  1529.     public function getComment()
  1530.     {
  1531.         return $this->comment;
  1532.     }
  1533.     /**
  1534.      * @param string $comment
  1535.      */
  1536.     public function setComment(string $comment null): void
  1537.     {
  1538.         $this->comment $comment;
  1539.     }
  1540.     /**
  1541.      * @return string
  1542.      */
  1543.     public function getCryptage()
  1544.     {
  1545.         return $this->cryptage;
  1546.     }
  1547.     /**
  1548.      * @param string $comment
  1549.      */
  1550.     public function setCryptage(string $cryptage null)
  1551.     {
  1552.         $this->cryptage $cryptage;
  1553.         return $this;
  1554.     }
  1555.     /**
  1556.      * Add customer.
  1557.      *
  1558.      * @param \App\Entity\Customer $customer
  1559.      *
  1560.      * @return Network
  1561.      */
  1562.     public function addCustomer(\App\Entity\Customer $customer)
  1563.     {
  1564.         /*Quick fix for not able to persist collection through cascade persist*/
  1565.         $customer->setNetwork($this);
  1566.         $customer->setSlotNumber(count($this->customers) + 1);
  1567.         $this->customers->add($customer);
  1568.         return $this;
  1569.     }
  1570.     /**
  1571.      * Remove customer.
  1572.      *
  1573.      * @param \App\Entity\Customer $customer
  1574.      *
  1575.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1576.      */
  1577.     public function removeCustomer(\App\Entity\Customer $customer)
  1578.     {
  1579.         /*Quick fix for not able to persist collection through cascade persist*/
  1580.         $customer->setNetwork(null);
  1581.         $customer->setSlotNumber(null);
  1582.         return $this->customers->removeElement($customer);
  1583.     }
  1584.     /**
  1585.      * Add device.
  1586.      *
  1587.      * @param \App\Entity\NetworkDevice $device
  1588.      *
  1589.      * @return Network
  1590.      */
  1591.     public function addDevice(\App\Entity\NetworkDevice $device)
  1592.     {
  1593.         $this->devices[] = $device;
  1594.         return $this;
  1595.     }
  1596.     /**
  1597.      * Remove device.
  1598.      *
  1599.      * @param \App\Entity\NetworkDevice $device
  1600.      *
  1601.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1602.      */
  1603.     public function removeDevice(\App\Entity\NetworkDevice $device)
  1604.     {
  1605.         $device->setNetwork(null);
  1606.         return $this->devices->removeElement($device);
  1607.     }
  1608.     /**
  1609.      * Add customerOperation.
  1610.      *
  1611.      * @param \App\Entity\CustomerOperations $customerOperation
  1612.      *
  1613.      * @return Network
  1614.      */
  1615.     public function addCustomerOperation(\App\Entity\CustomerOperations $customerOperation)
  1616.     {
  1617.         $this->customerOperations[] = $customerOperation;
  1618.         return $this;
  1619.     }
  1620.     /**
  1621.      * Remove customerOperation.
  1622.      *
  1623.      * @param \App\Entity\CustomerOperations $customerOperation
  1624.      *
  1625.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1626.      */
  1627.     public function removeCustomerOperation(\App\Entity\CustomerOperations $customerOperation)
  1628.     {
  1629.         return $this->customerOperations->removeElement($customerOperation);
  1630.     }
  1631.     /**
  1632.      * Add tensionRecord.
  1633.      *
  1634.      * @param \App\Entity\TensionRecord $tensionRecord
  1635.      *
  1636.      * @return Network
  1637.      */
  1638.     public function addTensionRecord(\App\Entity\TensionRecord $tensionRecord)
  1639.     {
  1640.         $this->tensionRecords[] = $tensionRecord;
  1641.         return $this;
  1642.     }
  1643.     /**
  1644.      * Remove tensionRecord.
  1645.      *
  1646.      * @param \App\Entity\TensionRecord $tensionRecord
  1647.      *
  1648.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1649.      */
  1650.     public function removeTensionRecord(\App\Entity\TensionRecord $tensionRecord)
  1651.     {
  1652.         return $this->tensionRecords->removeElement($tensionRecord);
  1653.     }
  1654.     /**
  1655.      * Add reloadRecord.
  1656.      *
  1657.      * @param \App\Entity\ReloadRecord $reloadRecord
  1658.      *
  1659.      * @return Network
  1660.      */
  1661.     public function addReloadRecord(\App\Entity\ReloadRecord $reloadRecord)
  1662.     {
  1663.         $this->reloadRecords[] = $reloadRecord;
  1664.         return $this;
  1665.     }
  1666.     /**
  1667.      * Remove reloadRecord.
  1668.      *
  1669.      * @param \App\Entity\ReloadRecord $reloadRecord
  1670.      *
  1671.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1672.      */
  1673.     public function removeReloadRecord(\App\Entity\ReloadRecord $reloadRecord)
  1674.     {
  1675.         return $this->reloadRecords->removeElement($reloadRecord);
  1676.     }
  1677.     /**
  1678.      * Add aggTensionRecord.
  1679.      *
  1680.      * @param \App\Entity\AggTensionRecord $aggTensionRecord
  1681.      *
  1682.      * @return Network
  1683.      */
  1684.     public function addAggTensionRecord(\App\Entity\AggTensionRecord $aggTensionRecord)
  1685.     {
  1686.         $this->aggTensionRecords[] = $aggTensionRecord;
  1687.         return $this;
  1688.     }
  1689.     /**
  1690.      * Remove aggTensionRecord.
  1691.      *
  1692.      * @param \App\Entity\AggTensionRecord $aggTensionRecord
  1693.      *
  1694.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1695.      */
  1696.     public function removeAggTensionRecord(\App\Entity\AggTensionRecord $aggTensionRecord)
  1697.     {
  1698.         return $this->aggTensionRecords->removeElement($aggTensionRecord);
  1699.     }
  1700.     /**
  1701.      * Add aggTransactionRecord.
  1702.      *
  1703.      * @param \App\Entity\AggTransactionRecord $aggTransactionRecord
  1704.      *
  1705.      * @return Network
  1706.      */
  1707.     public function addAggTransactionRecord(\App\Entity\AggTransactionRecord $aggTransactionRecord)
  1708.     {
  1709.         $this->aggTransactionRecords[] = $aggTransactionRecord;
  1710.         return $this;
  1711.     }
  1712.     /**
  1713.      * Remove aggTransactionRecord.
  1714.      *
  1715.      * @param \App\Entity\AggTransactionRecord $aggTransactionRecord
  1716.      *
  1717.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1718.      */
  1719.     public function removeAggTransactionRecord(\App\Entity\AggTransactionRecord $aggTransactionRecord)
  1720.     {
  1721.         return $this->aggTransactionRecords->removeElement($aggTransactionRecord);
  1722.     }
  1723.     /**
  1724.      * Add intervention.
  1725.      *
  1726.      * @param \App\Entity\Intervention $intervention
  1727.      *
  1728.      * @return Network
  1729.      */
  1730.     public function addIntervention(\App\Entity\Intervention $intervention)
  1731.     {
  1732.         $this->interventions[] = $intervention;
  1733.         return $this;
  1734.     }
  1735.     /**
  1736.      * Remove intervention.
  1737.      *
  1738.      * @param \App\Entity\Intervention $intervention
  1739.      *
  1740.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1741.      */
  1742.     public function removeIntervention(\App\Entity\Intervention $intervention)
  1743.     {
  1744.         return $this->interventions->removeElement($intervention);
  1745.     }
  1746.     /**
  1747.      * Add networkCustomerHistoric.
  1748.      *
  1749.      * @param \App\Entity\NetworkCustomerHistoric $networkCustomerHistoric
  1750.      *
  1751.      * @return Network
  1752.      */
  1753.     public function addNetworkCustomerHistoric(\App\Entity\NetworkCustomerHistoric $networkCustomerHistoric)
  1754.     {
  1755.         $this->networkCustomerHistoric[] = $networkCustomerHistoric;
  1756.         return $this;
  1757.     }
  1758.     /**
  1759.      * Remove networkCustomerHistoric.
  1760.      *
  1761.      * @param \App\Entity\NetworkCustomerHistoric $networkCustomerHistoric
  1762.      *
  1763.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1764.      */
  1765.     public function removeNetworkCustomerHistoric(\App\Entity\NetworkCustomerHistoric $networkCustomerHistoric)
  1766.     {
  1767.         return $this->networkCustomerHistoric->removeElement($networkCustomerHistoric);
  1768.     }
  1769.     /**
  1770.      * Add generatedCode.
  1771.      *
  1772.      * @param \App\Entity\GeneratedCode $generatedCode
  1773.      *
  1774.      * @return Network
  1775.      */
  1776.     public function addGeneratedCode(\App\Entity\GeneratedCode $generatedCode)
  1777.     {
  1778.         $this->generatedCodes[] = $generatedCode;
  1779.         return $this;
  1780.     }
  1781.     /**
  1782.      * Remove generatedCode.
  1783.      *
  1784.      * @param \App\Entity\GeneratedCode $generatedCode
  1785.      *
  1786.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1787.      */
  1788.     public function removeGeneratedCode(\App\Entity\GeneratedCode $generatedCode)
  1789.     {
  1790.         return $this->generatedCodes->removeElement($generatedCode);
  1791.     }
  1792.     /**
  1793.      * Get generatedCodes.
  1794.      *
  1795.      * @return \Doctrine\Common\Collections\Collection
  1796.      */
  1797.     public function getGeneratedCodes()
  1798.     {
  1799.         return $this->generatedCodes;
  1800.     }
  1801.     /**
  1802.      * Get generatedCode.
  1803.      *
  1804.      * @return \Doctrine\Common\Collections\Collection
  1805.      */
  1806.     public function getGeneratedCode()
  1807.     {
  1808.         return $this->generatedCode;
  1809.     }
  1810.     /**
  1811.      * Add commissionEntrepreneur.
  1812.      *
  1813.      * @param \App\Entity\Commission $commissionEntrepreneur
  1814.      *
  1815.      * @return Network
  1816.      */
  1817.     public function addCommissionEntrepreneur(\App\Entity\Commission $commissionEntrepreneur)
  1818.     {
  1819.         $this->commissionEntrepreneurs[] = $commissionEntrepreneur;
  1820.         return $this;
  1821.     }
  1822.     /**
  1823.      * Remove commissionEntrepreneur.
  1824.      *
  1825.      * @param \App\Entity\Commission $commissionEntrepreneur
  1826.      *
  1827.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1828.      */
  1829.     public function removeCommissionEntrepreneur(\App\Entity\Commission $commissionEntrepreneur)
  1830.     {
  1831.         return $this->commissionEntrepreneurs->removeElement($commissionEntrepreneur);
  1832.     }
  1833.     /**
  1834.      * Get commissionEntrepreneurs.
  1835.      *
  1836.      * @return \Doctrine\Common\Collections\Collection
  1837.      */
  1838.     public function getCommissionEntrepreneurs()
  1839.     {
  1840.         $datas $this->commissionEntrepreneurs->toArray();
  1841.         usort($datas, function($a$b) {
  1842.             return $a->getStartDate() <=> $b->getStartDate();
  1843.         });
  1844.         return new ArrayCollection($datas);
  1845.     }
  1846.     /**
  1847.      * Add nanoEntrepreneur.
  1848.      *
  1849.      * @param \App\Entity\NanoEntrepreneur $nanoEntrepreneur
  1850.      *
  1851.      * @return Network
  1852.      */
  1853.     public function addNanoEntrepreneur(\App\Entity\NanoEntrepreneur $nanoEntrepreneur)
  1854.     {
  1855.         $this->nanoEntrepreneurs[] = $nanoEntrepreneur;
  1856.         if (!$this->nanoEntrepreneurs->contains($nanoEntrepreneur)) {
  1857.             $this->nanoEntrepreneurs[] = $nanoEntrepreneur;
  1858.             $nanoEntrepreneur->setNetwork($this);
  1859.         }
  1860.         return $this;
  1861.     }
  1862.     public function removeNanoEntrepreneur(\App\Entity\NanoEntrepreneur $nanoEntrepreneur): self
  1863.     {
  1864.         if ($this->nanoEntrepreneurs->removeElement($nanoEntrepreneur)) {
  1865.             // set the owning side to null (unless already changed)
  1866.             if ($nanoEntrepreneur->getNetwork() === $this) {
  1867.                 $nanoEntrepreneur->setNetwork(null);
  1868.             }
  1869.         }
  1870.         return $this;
  1871.     }
  1872.     /**
  1873.      * Get nanoEntrepreneurs.
  1874.      *
  1875.      * @return \Doctrine\Common\Collections\Collection
  1876.      */
  1877.     public function getNanoEntrepreneurs()
  1878.     {
  1879.         $datas $this->nanoEntrepreneurs->toArray();
  1880.         usort($datas, function($a$b) {
  1881.             return $a->getStartDate() <=> $b->getStartDate();
  1882.         });
  1883.         return new ArrayCollection($datas);
  1884.     }
  1885.     /**
  1886.      * @param NanoEntrepreneur $nanoEntrepreneur
  1887.      * @return Network
  1888.      */
  1889.     public function addNanoEntrepreneurs(NanoEntrepreneur $nanoEntrepreneur)
  1890.     {
  1891.         if (!$this->nanoEntrepreneurs->contains($nanoEntrepreneur)) {
  1892.             $this->nanoEntrepreneurs->add($nanoEntrepreneur);
  1893.             $nanoEntrepreneur->setNetwork($this);
  1894.         }
  1895.         return $this;
  1896.     }
  1897.     /**
  1898.      * @param NanoEntrepreneur $nanoEntrepreneur
  1899.      * @return Network
  1900.      */
  1901.     public function setNanoEntrepreneur(NanoEntrepreneur $nanoEntrepreneur)
  1902.     {
  1903.         return $this->addNanoEntrepreneurs($nanoEntrepreneur);
  1904.     }
  1905.     /**
  1906.      * @param Commission $commission
  1907.      * @return Network
  1908.      */
  1909.     public function addCommissionEntrepreneurs(Commission $commission)
  1910.     {
  1911.         if (!$this->commissionEntrepreneurs->contains($commission)) {
  1912.             $this->commissionEntrepreneurs->add($commission);
  1913.             $commission->setNetwork($this);
  1914.         }
  1915.         return $this;
  1916.     }
  1917.     /**
  1918.      * @param Commission $commission
  1919.      * @return Network
  1920.      */
  1921.     public function removeCommissionEntrepreneurs(Commission $commission)
  1922.     {
  1923.         if ($this->commissionEntrepreneurs->contains($commission)) {
  1924.             $this->commissionEntrepreneurs->removeElement($commission);
  1925.             $commission->setNetwork(null);
  1926.         }
  1927.         return $this;
  1928.     }
  1929.     /**
  1930.      * @param Commission $commission
  1931.      * @return Network
  1932.      */
  1933.     public function setCommissionEntrepreneur(Commission $commission)
  1934.     {
  1935.         return $this->addCommissionEntrepreneurs($commission);
  1936.     }
  1937.     /**
  1938.      * @return int
  1939.      */
  1940.     public function getPuissance($networkDevices): int
  1941.     {
  1942.         $this->puissance 0;
  1943.         $ideviceDimension 0;
  1944.         foreach ($networkDevices as $networkDevice) {
  1945.             if (empty($networkDevice->getDateDeletion())) {
  1946.                 $aDeviceDimensions $networkDevice->getDevice()->getDeviceDimension()->toArray();
  1947.                 foreach ($aDeviceDimensions as $deviceDimension) {
  1948.                     if ($deviceDimension->getUnit() === 'Wc' && $networkDevice->getDevice()->getType()->getId() == 1) {
  1949.                         $ideviceDimension = (int) $deviceDimension->getValue();
  1950.                         $this->puissance += $ideviceDimension * (int) $networkDevice->getDeviceCount();
  1951.                     }
  1952.                 }
  1953.             }
  1954.         }
  1955.         return $this->puissance;
  1956.     }
  1957.     /**
  1958.      * @return int
  1959.      */
  1960.     public function getCapaciteStockage($networkDevices): int
  1961.     {
  1962.         $this->capaciteStockage 0;
  1963.         $ideviceDimension 0;
  1964.         foreach ($networkDevices as $networkDevice) {
  1965.             if (empty($networkDevice->getDateDeletion())) {
  1966.                 $aDeviceDimensions $networkDevice->getDevice()->getDeviceDimension()->toArray();
  1967.                 foreach ($aDeviceDimensions as $deviceDimension) {
  1968.                     if ($deviceDimension->getUnit() === 'Ah' && $networkDevice->getDevice()->getType()->getId() == 3) {
  1969.                         $ideviceDimension = (int) $deviceDimension->getValue();
  1970.                         $this->capaciteStockage += $ideviceDimension * (int) $networkDevice->getDeviceCount();
  1971.                     }
  1972.                 }
  1973.             }
  1974.         }
  1975.         return $this->capaciteStockage;
  1976.     }
  1977.     /**
  1978.      * @return Collection<int, Stock>
  1979.      */
  1980.     public function getStocks(): Collection
  1981.     {
  1982.         return $this->stocks;
  1983.     }
  1984.     public function addStock(Stock $stock): self
  1985.     {
  1986.         if (!$this->stocks->contains($stock)) {
  1987.             $this->stocks[] = $stock;
  1988.             $stock->setNanoReseau($this);
  1989.         }
  1990.         return $this;
  1991.     }
  1992.     public function removeStock(Stock $stock): self
  1993.     {
  1994.         if ($this->stocks->removeElement($stock)) {
  1995.             // set the owning side to null (unless already changed)
  1996.             if ($stock->getNanoReseau() === $this) {
  1997.                 $stock->setNanoReseau(null);
  1998.             }
  1999.         }
  2000.         return $this;
  2001.     }
  2002. }