src/Entity/Project/Project.php line 519

Open in your IDE?
  1. <?php
  2. /*
  3.  * Created on Fri Dec 02 2022
  4.  *
  5.  * DAVID-OLIVIER DESCOMBES
  6.  *
  7.  * @licence
  8.  * You may not sell, sub-license, rent or lease any portion of the Software or Documentation to anyone.
  9.  *
  10.  * Copyright (c) 2022 dodarchitecte.com (https://dodarchitecte.com)
  11.  *
  12.  * Developed by developpeur-informatique.ma (https://www.developpeur-informatique.ma)
  13.  */
  14. namespace App\Entity\Project;
  15. use ApiPlatform\Core\Annotation\ApiResource;
  16. use App\Controller\Project\ProjectAllFoldersController;
  17. use App\Controller\Project\ProjectConversationController;
  18. use App\Controller\Project\ProjectDevisController;
  19. use App\Controller\Project\ProjectDiscardedController;
  20. use App\Controller\Project\ProjectDisponibleController;
  21. use App\Controller\Project\ProjectImageController;
  22. use App\Controller\Project\ProjectPurchasesController;
  23. use App\Controller\Project\ProjectFilesController;
  24. use App\Controller\Project\ProjectFoldersController;
  25. use App\Controller\Project\ProjectFileTransmisController;
  26. use App\Controller\Project\ProjectFinanceController;
  27. use App\Controller\Project\ProjectFinancialMonitoringPdfController;
  28. use App\Controller\Project\ProjectGeneratePdfController;
  29. use App\Controller\Project\ProjectUntouchedController;
  30. use App\Entity\Chat\Conversation;
  31. use App\Entity\Collaborator\CollaboratorProject;
  32. use App\Entity\Devis\Devis;
  33. use App\Entity\Responsable\Responsable;
  34. use App\Entity\Enterprise\Enterprise;
  35. use App\Entity\Folder\Folder;
  36. use App\Entity\Localisation\Address;
  37. use App\Entity\TraitFolder\TimeStamp;
  38. use App\Entity\User;
  39. use App\Repository\Collaborator\CollaboratorRepository;
  40. use App\Repository\Project\ProjectRepository;
  41. use Doctrine\Common\Collections\ArrayCollection;
  42. use Doctrine\Common\Collections\Collection;
  43. use Doctrine\ORM\Mapping as ORM;
  44. use Doctrine\ORM\NonUniqueResultException;
  45. use Symfony\Component\HttpFoundation\File\File;
  46. use Symfony\Component\Serializer\Annotation\Groups;
  47. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  48. // use Vich\UploaderBundle\Entity\File as EmbeddedFile;
  49. #[ORM\Entity(repositoryClassProjectRepository::class)]
  50. #[Vich\Uploadable()]
  51. #[ApiResource(
  52.     collectionOperations: [
  53.         'get' => [
  54.             'normalization_context' => ['groups' => 'Project:collection'],
  55.         ],
  56.         'post' => [
  57.             'normalization_context' => ['groups' => 'Project:collection'],
  58.         ],
  59.         'discarded' => [
  60.             'method' => 'GET',
  61.             'path' => '/projects/discarded',
  62.             'controller' => ProjectDiscardedController::class,
  63.             'openapi_context' => [
  64.                 'summary' => 'Get all discarded projects',
  65.                 'description' => 'Get all discarded projects',
  66.                 'responses' => [
  67.                     '200' => [
  68.                         'description' => 'A list of projects',
  69.                         'schema' => [
  70.                             'type' => 'array',
  71.                             'items' => [
  72.                                 '$ref' => '#/components/schemas/Project',
  73.                             ],
  74.                         ]
  75.                     ]
  76.                 ]
  77.             ],
  78.             'openapi_description' => 'Get all discarded projects',
  79.         ],
  80.         'follow_finance' => [
  81.             'method' => 'GET',
  82.             'path' => '/projects/follow_finance',
  83.             'normalization_context' => ['groups' => 'Project:finance'],
  84.             'controller' => ProjectFinanceController::class,
  85.             'openapi_context' => [
  86.                 'summary' => 'Get all projects to follow finance',
  87.                 'description' => 'Get all projects to follow finance',
  88.                 'responses' => [
  89.                     '200' => [
  90.                         'description' => 'A list of projects',
  91.                         'schema' => [
  92.                             'type' => 'array',
  93.                             'items' => [
  94.                                 '$ref' => '#/components/schemas/Project',
  95.                             ],
  96.                         ]
  97.                     ]
  98.                 ]
  99.             ],
  100.         ],
  101.         'untouched' => [
  102.             'method' => 'GET',
  103.             'path' => '/projects/untouched',
  104.             'normalization_context' => ['groups' => ['Project:untouched']],
  105.             'controller' => ProjectUntouchedController::class,
  106.             'openapi_context' => [
  107.                 'summary' => 'Get all untouched projects',
  108.                 'description' => 'Get all untouched projects',
  109.                 'responses' => [
  110.                     '200' => [
  111.                         'description' => 'A list of projects',
  112.                         'schema' => [
  113.                             'type' => 'array',
  114.                             'items' => [
  115.                                 '$ref' => '#/components/schemas/Project',
  116.                             ],
  117.                         ]
  118.                     ]
  119.                 ]
  120.             ],
  121.             'openapi_description' => 'Get all untouched projects',
  122.         ],
  123.         'disponible_for_devis' => [
  124.             'method' => 'GET',
  125.             'path' => '/projects/disponible_for_devis',
  126.             'controller' => ProjectDisponibleController::class,
  127.             'openapi_context' => [
  128.                 'summary' => 'Get all disponible projects',
  129.                 'description' => 'Get all disponible projects',
  130.                 'responses' => [
  131.                     '200' => [
  132.                         'description' => 'A list of projects',
  133.                         'schema' => [
  134.                             'type' => 'array',
  135.                             'items' => [
  136.                                 '$ref' => '#/components/schemas/Project',
  137.                             ],
  138.                         ]
  139.                     ]
  140.                 ]
  141.             ],
  142.             'openapi_description' => 'Get all discarded projects',
  143.         ],
  144.     ],
  145.     itemOperations: [
  146.         'get' => ["security" => "is_granted('POST_VIEW', object)"],
  147.         'put' => [
  148.             "openapiContext" => [
  149.                 "deserialize" => false,
  150.                 'requestBody' => [
  151.                     'content' => [
  152.                         'multipart/form-data' => [
  153.                             'schema' => [
  154.                                 'type' => 'object',
  155.                                 'properties' => [
  156.                                     'file' => [
  157.                                         'type' => 'string',
  158.                                         'format' => 'binary'
  159.                                     ]
  160.                                 ]
  161.                             ]
  162.                         ]
  163.                     ]
  164.                 ]
  165.             ]
  166.         ],
  167.         'delete',
  168.         'patch',
  169.         'image' => [
  170.             'method' => 'POST',
  171.             'path' => '/projects/{id}/image',
  172.             'controller' => ProjectImageController::class,
  173.             'deserialize' => false,
  174.             'openapi_context' => [
  175.                 'requestBody' => [
  176.                     'content' => [
  177.                         'multipart/form-data' => [
  178.                             'schema' => [
  179.                                 'type' => 'object',
  180.                                 'properties' => [
  181.                                     'file' => [
  182.                                         'type' => 'string',
  183.                                         'format' => 'binary'
  184.                                     ]
  185.                                 ]
  186.                             ]
  187.                         ]
  188.                     ]
  189.                 ]
  190.             ],
  191.         ],
  192.         'purchases' => [
  193.             'method' => 'GET',
  194.             'path' => '/projects/{id}/purchases',
  195.             'controller' => ProjectPurchasesController::class,
  196.             'normalization_context' => ['groups' => 'Project:purchases'],
  197.             'openapi_context' => [
  198.                 'summary' => 'Get all purchases of a project',
  199.                 'description' => 'Get all purchases of a project',
  200.                 'responses' => [
  201.                     '200' => [
  202.                         'description' => 'Return all purchases of a project',
  203.                         'content' => [
  204.                             'application/json' => [
  205.                                 'schema' => [
  206.                                     'type' => 'array',
  207.                                     'items' => [
  208.                                         '$ref' => '#/components/schemas/Purchase'
  209.                                     ]
  210.                                 ]
  211.                             ]
  212.                         ]
  213.                     ]
  214.                 ]
  215.             ],
  216.         ],
  217.         'files' => [
  218.             'method' => 'GET',
  219.             'path' => '/projects/{id}/files',
  220.             'controller' => ProjectFilesController::class,
  221.             'openapi_context' => [
  222.                 'summary' => 'Get all files of a project',
  223.                 'description' => 'Get all files of a project',
  224.                 'responses' => [
  225.                     '200' => [
  226.                         'description' => 'Return all files of a project',
  227.                         'content' => [
  228.                             'application/json' => [
  229.                                 'schema' => [
  230.                                     'type' => 'array',
  231.                                     'items' => [
  232.                                         '$ref' => '#/components/schemas/File'
  233.                                     ]
  234.                                 ]
  235.                             ]
  236.                         ]
  237.                     ]
  238.                 ]
  239.             ]
  240.         ],
  241.         'folders' => [
  242.             'method' => 'GET',
  243.             'path' => '/projects/{id}/folders/{type}',
  244.             'controller' => ProjectFoldersController::class,
  245.             'openapi_context' => [
  246.                 'summary' => 'Get all folders of a project',
  247.                 'description' => 'Get all folders of a project',
  248.                 'responses' => [
  249.                     '200' => [
  250.                         'description' => 'Return all folders of a project',
  251.                         'content' => [
  252.                             'application/json' => [
  253.                                 'schema' => [
  254.                                     'type' => 'array',
  255.                                     'items' => [
  256.                                         '$ref' => '#/components/schemas/Folder'
  257.                                     ]
  258.                                 ]
  259.                             ]
  260.                         ]
  261.                     ]
  262.                 ],
  263.                 'parameters' => [
  264.                     [
  265.                         'name' => 'type',
  266.                         'in' => 'path',
  267.                         'required' => true,
  268.                         'schema' => [
  269.                             'type' => 'string',
  270.                             'enum' => [
  271.                                 'Facture',
  272.                                 'Contrat',
  273.                                 'Chantier',
  274.                                 'Projet'
  275.                             ]
  276.                         ]
  277.                     ]
  278.                 ],
  279.             ],
  280.             'requirements' => [
  281.                 'type' => 'Facture|Contrat|Chantier|Projet'
  282.             ],
  283.             'normalization_context' =>
  284.                 [
  285.                     'groups' => ['Project:read:folders'],
  286.                     'openapi_definition_name' => 'Get folders of a project'
  287.                 ]
  288.         ],
  289.         'all_folders' => [
  290.             'method' => 'GET',
  291.             'path' => '/projects/{id}/all_folders',
  292.             'controller' => ProjectAllFoldersController::class,
  293.             'openapi_context' => [
  294.                 'summary' => 'Get all folders of a project',
  295.                 'description' => 'Get all folders of a project',
  296.                 'responses' => [
  297.                     '200' => [
  298.                         'description' => 'Return all folders of a project',
  299.                         'content' => [
  300.                             'application/json' => [
  301.                                 'schema' => [
  302.                                     'type' => 'array',
  303.                                     'items' => [
  304.                                         '$ref' => '#/components/schemas/Folder'
  305.                                     ]
  306.                                 ]
  307.                             ]
  308.                         ]
  309.                     ]
  310.                 ],
  311.                 'parameters' => [
  312.                     [
  313.                         'name' => 'type',
  314.                         'in' => 'path',
  315.                         'required' => true,
  316.                         'schema' => [
  317.                             'type' => 'string',
  318.                             'enum' => [
  319.                                 'Facture',
  320.                                 'Contrat',
  321.                                 'Chantier',
  322.                                 'Projet'
  323.                             ]
  324.                         ]
  325.                     ]
  326.                 ],
  327.             ],
  328.             'requirements' => [
  329.                 'type' => 'Facture|Contrat|Chantier|Projet'
  330.             ],
  331.             'normalization_context' =>
  332.                 [
  333.                     'groups' => ['Project:read:folders'],
  334.                     'openapi_definition_name' => 'Get folders of a project'
  335.                 ]
  336.         ],
  337.         'transmis' => [
  338.             'method' => 'GET',
  339.             'path' => '/projects/{id}/transmis',
  340.             'controller' => ProjectFileTransmisController::class,
  341.             'openapi_context' => [
  342.                 'summary' => 'Get all files transmis of a project',
  343.                 'description' => 'Get all files transmis of a project',
  344.                 'responses' => [
  345.                     '200' => [
  346.                         'description' => 'Return all files transmis of a project',
  347.                         'content' => [
  348.                             'application/json' => [
  349.                                 'schema' => [
  350.                                     'type' => 'array',
  351.                                     'items' => [
  352.                                         '$ref' => '#/components/schemas/File'
  353.                                     ]
  354.                                 ]
  355.                             ]
  356.                         ]
  357.                     ]
  358.                 ]
  359.             ]
  360.         ],
  361.         'generate_pdf' => [
  362.             'method' => 'POST',
  363.             'path' => '/projects/{id}/generate_pdf',
  364.             'controller' => ProjectGeneratePdfController::class,
  365.             'openapi_context' => [
  366.                 'summary' => 'Generate a pdf of a project',
  367.                 'description' => 'Generate a pdf of a project',
  368.                 'responses' => [
  369.                     '200' => [
  370.                         'description' => 'Return a pdf of a project',
  371.                         'content' => [
  372.                             'application/pdf' => [
  373.                                 'schema' => [
  374.                                     'type' => 'string',
  375.                                     'format' => 'binary'
  376.                                 ]
  377.                             ]
  378.                         ]
  379.                     ]
  380.                 ],
  381.                 'requestBody' => [
  382.                     'content' => [
  383.                         'application/ld+json' => [
  384.                             'schema' => [
  385.                                 'type' => 'object',
  386.                                 'properties' => [
  387.                                     'folder' => [
  388.                                         'type' => 'Folder',
  389.                                         'format' => 'Folder'
  390.                                     ]
  391.                                 ]
  392.                             ]
  393.                         ]
  394.                     ]
  395.                 ]
  396.                 // 'serialize' => false,
  397.             ],
  398.             'normalization_context' =>
  399.                 [
  400.                     'groups' => ['Project:SuiviFinance'],
  401.                     'openapi_definition_name' => 'Get folders of a project'
  402.                 ],
  403.             // 'security' => 'is_granted("ROLE_CHEF") or is_granted("ROLE_ADMIN") or is_granted("ROLE_SECRETARY")',
  404.         ],
  405.         'suivi_financier_pdf' => [
  406.             'method' => 'GET',
  407.             'path' => '/projects/{id}/suivi_financier_pdf',
  408.             'controller' => ProjectFinancialMonitoringPdfController::class,
  409.             'openapi_context' => [
  410.                 'summary' => 'Generate a  financial monitoring  pdf of a project',
  411.                 'description' => 'Generate a  financial monitoring  pdf of a project',
  412.                 'responses' => [
  413.                     '200' => [
  414.                         'description' => 'Return a   financial monitoring  pdf of a project',
  415.                         'content' => [
  416.                             'application/pdf' => [
  417.                                 'schema' => [
  418.                                     'type' => 'string',
  419.                                     'format' => 'binary'
  420.                                 ]
  421.                             ]
  422.                         ]
  423.                     ]
  424.                 ]
  425.             ],
  426.             'normalization_context' =>
  427.                 [
  428.                     'groups' => ['Project:SuiviFinance'],
  429.                     'openapi_definition_name' => 'Get folders of a project'
  430.                 ],
  431.             'serialize' => false,
  432.             // 'security' => 'is_granted("ROLE_CHEF") or is_granted("ROLE_ADMIN") or is_granted("ROLE_SECRETARY")',
  433.         ],
  434.         'conversations' => [
  435.             'method' => 'GET',
  436.             'path' => '/projects/{id}/conversations',
  437.             'controller' => ProjectConversationController::class,
  438.             'normalization_context' => ['groups' => ['Project:conversation']],
  439.             'openapi_context' => [
  440.                 'summary' => 'Get all conversations of a project',
  441.                 'description' => 'Get all conversations of a project',
  442.                 'responses' => [
  443.                     '200' => [
  444.                         'description' => 'Return all conversations of a project',
  445.                         'content' => [
  446.                             'application/json' => [
  447.                                 'schema' => [
  448.                                     'type' => 'array',
  449.                                     'items' => [
  450.                                         '$ref' => '#/components/schemas/Conversation'
  451.                                     ]
  452.                                 ]
  453.                             ]
  454.                         ]
  455.                     ]
  456.                 ]
  457.             ],
  458.         ],
  459.         'devis' => [
  460.             'method' => 'GET',
  461.             'path' => '/projects/{id}/devis',
  462.             'controller' => ProjectDevisController::class,
  463.             'openapi_context' => [
  464.                 'summary' => 'Get all devis of a project',
  465.                 'description' => 'Get all devis of a project',
  466.                 'responses' => [
  467.                     '200' => [
  468.                         'description' => 'Return all devis of a project',
  469.                         'content' => [
  470.                             'application/json' => [
  471.                                 'schema' => [
  472.                                     'type' => 'array',
  473.                                     'items' => [
  474.                                         '$ref' => '#/components/schemas/Devis'
  475.                                     ]
  476.                                 ]
  477.                             ]
  478.                         ]
  479.                     ]
  480.                 ]
  481.             ]
  482.         ],
  483.     ],
  484.     denormalizationContext: [
  485.         'groups' => ['Project:write'],
  486.         'disable_type_enforcement' => true,
  487.     ],
  488.     normalizationContext: ['groups' => ['Project:collection''Project:read']],
  489.     // attributes: [
  490.     //     "pagination_client_enabled" => true,
  491.     //     "pagination_client_items_per_page" => 10,
  492.     // ],
  493.     // paginationClientEnabled: true,
  494.     // paginationItemsPerPage: 10,
  495.     // paginationMaximumItemsPerPage: 10,
  496.     order: ["status" => "Asc""updatedAt" => "Desc"]
  497. )]
  498. class Project
  499. {
  500.     use TimeStamp;
  501.     #[ORM\Id]
  502.     #[ORM\GeneratedValue]
  503.     #[ORM\Column(type'integer')]
  504.     #[Groups([
  505.         'Project:collection''Project:read''User:Projects',
  506.         'Company:collection''Project:finance''Dod:facture',
  507.         'Dod:gestionnaire''Dod:Factures''Project:discarded'"Company:Projects",
  508.         'Project:Disponible',
  509.       'Collaborator:read',"User:collaborator""User:clients"
  510.     ])]
  511. //    #[Groups([ "User:collaborator", "User:clients", "Collaborator:read"])]
  512.     private $id;
  513.     #[ORM\Column(type'string'length255)]
  514.     #[Groups([
  515.         'Project:collection''Project:read''Project:write',
  516.         'User:Projects''Company:collection',
  517.         'Project:finance',
  518.         'Conversation:collection',
  519.         'User:Conversation''File:Facture',
  520.         'Dod:facture''Dod:gestionnaire''Company:collection',
  521.         'Devis:collection''Dod:Factures''Project:discarded'"Company:Projects",
  522.         'Project:Disponible',
  523. //        'Collaborator:read',"User:collaborator", "User:clients"
  524.     ])]
  525.     private $name;
  526.     #[ORM\Column(type'string'length255)]
  527.     #[Groups([
  528.         'Project:collection''User:Projects''Project:read''Company:collection',
  529.         'Project:finance''Project:discarded'"Company:Projects"
  530.     ])]
  531.     private $slug;
  532.     #[ORM\Column(type'string'length255)]
  533.     #[Groups([
  534.         'Project:collection',
  535.         'User:Projects''Project:read''Project:write''Company:collection',
  536.         'Company:collection''Project:finance''Project:discarded'"Company:Projects"
  537.     ])]
  538.     private $status;
  539.     #[ORM\ManyToOne(targetEntityEnterprise::class, inversedBy'projects')]
  540.     #[ORM\JoinColumn(nullablefalse)]
  541.     #[Groups([
  542.         'Project:collection''User:Projects''Project:read''Project:write',
  543.         'Conversation:read''Project:discarded'
  544.     ])]
  545.     private $enterprise;
  546.     #[ORM\OneToOne(targetEntityAddress::class, cascade: ['persist''remove'])]
  547.     #[Groups(['Project:collection''User:Projects''Project:read''Project:write'])]
  548.     private $address;
  549.     #[ORM\OneToMany(mappedBy'project'targetEntityPurchase::class, cascade: ['persist''remove'])]
  550.     #[Groups(['Project:read''Project:write'])]
  551.     private $purchases;
  552.     #[ORM\OneToMany(mappedBy'project'targetEntityFolder::class, cascade: ['persist''remove'])]
  553.     #[Groups([
  554.         'Project:read''Project:finance''Project:SuiviFinance',
  555.     ])]
  556.     private $folders;
  557.     /**
  558.      *
  559.      * @var File
  560.      */
  561.     #[Vich\UploadableField(mapping'project_image'fileNameProperty'fileName')]
  562.     #[Groups(['Project:write'])]
  563.     private ?File $file null;
  564.     #[ORM\Column(type'string'length255nullabletrue)]
  565.     #[Groups(['Project:collection''User:Projects''Project:read'])]
  566.     private ?string $fileName null;
  567.     /**
  568.      * @var string|null
  569.      *
  570.      */
  571.     #[Groups(['Project:collection''User:Projects''Project:read''Conversation:read''Conversation:collection'])]
  572.     private ?string $fileUrl null;
  573.     #[ORM\Column(type'string'length255)]
  574.     #[Groups(['Project:write''Project:read''Project:collection''User:Projects''Project:finance'])]
  575.     private $programme;
  576.     #[ORM\Column(type'decimal'precision50scale2nullabletrue)]
  577.     #[Groups(['Project:write''Project:read''Project:collection''User:Projects''Project:finance'])]
  578.     private $surface;
  579.     #[ORM\Column(type'datetime'nullabletrue)]
  580.     #[Groups(['Project:write''Project:read'])]
  581.     private $startedAt;
  582.     #[ORM\Column(type'datetime'nullabletrue)]
  583.     #[Groups(['Project:write''Project:read'])]
  584.     private $endingAt;
  585.     #[ORM\Column(type'boolean'nullabletrueoptions: ['default' => false])]
  586.     #[Groups([
  587.         'Project:write''Project:collection''Project:read''User:Projects',
  588.         'Conversation:read''Conversation:collection'"Company:Projects"
  589.     ])]
  590.     private $discarded;
  591.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  592.     #[Groups(['Project:write''Project:collection''Project:read''Project:discarded'])]
  593.     private $discardedAt;
  594.     #[ORM\Column(type'string'length10nullabletrue)]
  595.     #[Groups(['Project:write''Project:collection''Project:read'])]
  596.     private $maitreOuvrage;
  597.     #[ORM\Column(type'string'length10nullabletrue)]
  598.     #[Groups(['Project:write''Project:collection''Project:read''User:Projects'])]
  599.     private $etude;
  600.     #[Groups(['Project:conversation'])]
  601.     #[ORM\OneToMany(mappedBy'project'targetEntityConversation::class, cascade: ['persist''remove'])]
  602.     private Collection $conversations;
  603.     #[ORM\OneToMany(mappedBy'project'targetEntityDevis::class, cascade: ['persist''remove'])]
  604.     private Collection $devis;
  605.     #[ORM\OneToMany(mappedBy'project'targetEntityResponsable::class, cascade: ['persist''remove'])]
  606.     #[Groups(['Project:write''Project:collection''Project:read''User:Projects'])]
  607.     private Collection $responsables;
  608.     #[Groups(['Project:read'])]
  609.     private bool $allowedToSigne false;
  610.     #[ORM\OneToMany(mappedBy'project'targetEntityCollaboratorProject::class)]
  611.     private Collection $collaboratorProjects;
  612.     public function __construct()
  613.     {
  614.         $this->purchases = new ArrayCollection();
  615.         $this->folders = new ArrayCollection();
  616.         $this->slug uniqid(''false);
  617.         $this->createdAt = new \DateTime();
  618.         $this->updatedAt = new \DateTime();
  619.         $this->conversations = new ArrayCollection();
  620.         $this->devis = new ArrayCollection();
  621.         $this->responsables = new ArrayCollection();
  622.         $this->collaboratorProjects = new ArrayCollection();
  623.     }
  624.     public function getId(): ?int
  625.     {
  626.         return $this->id;
  627.     }
  628.     public function getSlug(): string|null
  629.     {
  630.         return $this->slug;
  631.     }
  632.     public function getName(): ?string
  633.     {
  634.         return $this->name;
  635.     }
  636.     public function setName(string $name): self
  637.     {
  638.         $this->name $name;
  639.         return $this;
  640.     }
  641.     public function getStatus(): ?string
  642.     {
  643.         return $this->status;
  644.     }
  645.     public function setStatus(string $status): self
  646.     {
  647.         $this->status $status;
  648.         return $this;
  649.     }
  650.     public function getEnterprise(): ?Enterprise
  651.     {
  652.         return $this->enterprise;
  653.     }
  654.     public function setEnterprise(?Enterprise $enterprise): self
  655.     {
  656.         $this->enterprise $enterprise;
  657.         return $this;
  658.     }
  659.     public function getAddress(): ?Address
  660.     {
  661.         return $this->address;
  662.     }
  663.     public function setAddress(?Address $address): self
  664.     {
  665.         $this->address $address;
  666.         return $this;
  667.     }
  668.     /**
  669.      * @return Collection<int, Purchase>
  670.      */
  671.     public function getPurchases(): Collection
  672.     {
  673.         return $this->purchases;
  674.     }
  675.     public function addPurchase(Purchase $purchase): self
  676.     {
  677.         if (!$this->purchases->contains($purchase)) {
  678.             $this->purchases[] = $purchase;
  679.             $purchase->setProject($this);
  680.         }
  681.         return $this;
  682.     }
  683.     public function removePurchase(Purchase $purchase): self
  684.     {
  685.         if ($this->purchases->removeElement($purchase)) {
  686.             // set the owning side to null (unless already changed)
  687.             if ($purchase->getProject() === $this) {
  688.                 $purchase->setProject(null);
  689.             }
  690.         }
  691.         return $this;
  692.     }
  693.     /**
  694.      * @return Collection<int, Folder>
  695.      */
  696.     public function getFolders(): Collection
  697.     {
  698.         return $this->folders;
  699.     }
  700.     public function addFolder(Folder $folder): self
  701.     {
  702.         if (!$this->folders->contains($folder)) {
  703.             $this->folders[] = $folder;
  704.             $folder->setProject($this);
  705.         }
  706.         return $this;
  707.     }
  708.     public function setFolders(?Collection $folders): self
  709.     {
  710.         $this->folders $folders ?? new ArrayCollection();
  711.         return $this;
  712.     }
  713.     public function removeFolder(Folder $folder): self
  714.     {
  715.         if ($this->folders->removeElement($folder)) {
  716.             // set the owning side to null (unless already changed)
  717.             if ($folder->getProject() === $this) {
  718.                 $folder->setProject(null);
  719.             }
  720.         }
  721.         return $this;
  722.     }
  723.     public function getFileName(): ?string
  724.     {
  725.         return $this->fileName;
  726.     }
  727.     public function setFileName(?string $fileName): self
  728.     {
  729.         $this->fileName $fileName;
  730.         return $this;
  731.     }
  732.     public function getFile(): ?File
  733.     {
  734.         return $this->file;
  735.     }
  736.     public function setFile(?File $file): self
  737.     {
  738.         $this->file $file;
  739.         if ($file) {
  740.             $this->updatedAt = new \DateTime('now');
  741.         }
  742.         return $this;
  743.     }
  744.     public function getFileUrl(): ?string
  745.     {
  746.         return $this->fileUrl;
  747.     }
  748.     public function setFileUrl(?string $fileUrl): self
  749.     {
  750.         $this->fileUrl $fileUrl;
  751.         return $this;
  752.     }
  753.     // public function setUpdatedAt(): self
  754.     // {
  755.     //     $this->updatedAt = new \DateTime('now');
  756.     //     return $this;
  757.     // }
  758.     public function getProgramme(): ?string
  759.     {
  760.         return $this->programme;
  761.     }
  762.     public function setProgramme(string $programme): self
  763.     {
  764.         $this->programme $programme;
  765.         return $this;
  766.     }
  767.     public function getSurface(): ?string
  768.     {
  769.         return $this->surface;
  770.     }
  771.     public function setSurface(?string $surface): self
  772.     {
  773.         $this->surface $surface;
  774.         return $this;
  775.     }
  776.     public function getStartedAt(): ?\DateTimeInterface
  777.     {
  778.         return $this->startedAt;
  779.     }
  780.     public function setStartedAt(?\DateTimeInterface $startedAt): self
  781.     {
  782.         $this->startedAt $startedAt;
  783.         return $this;
  784.     }
  785.     public function getEndingAt(): ?\DateTimeInterface
  786.     {
  787.         return $this->endingAt;
  788.     }
  789.     public function setEndingAt(?\DateTimeInterface $endingAt): self
  790.     {
  791.         $this->endingAt $endingAt;
  792.         return $this;
  793.     }
  794.     public function isDiscarded(): ?bool
  795.     {
  796.         return $this->discarded;
  797.     }
  798.     public function setDiscarded(bool $discarded): self
  799.     {
  800.         $this->discarded $discarded;
  801.         if ($discarded)
  802.             $this->discardedAt = new \DateTimeImmutable();
  803.         else
  804.             $this->discardedAt null;
  805.         return $this;
  806.     }
  807.     public function getDiscardedAt(): ?\DateTimeImmutable
  808.     {
  809.         return $this->discardedAt;
  810.     }
  811.     public function setDiscardedAt(?\DateTimeImmutable $discardedAt): self
  812.     {
  813.         $this->discardedAt $discardedAt;
  814.         return $this;
  815.     }
  816.     public function getMaitreOuvrage(): ?string
  817.     {
  818.         return $this->maitreOuvrage;
  819.     }
  820.     public function setMaitreOuvrage(?string $maitreOuvrage): self
  821.     {
  822.         $this->maitreOuvrage $maitreOuvrage;
  823.         return $this;
  824.     }
  825.     public function getEtude(): ?string
  826.     {
  827.         return $this->etude;
  828.     }
  829.     public function setEtude(?string $etude): self
  830.     {
  831.         $this->etude $etude;
  832.         return $this;
  833.     }
  834.     /**
  835.      * @return Collection<int, Conversation>
  836.      */
  837.     public function getConversations(): Collection
  838.     {
  839.         return $this->conversations;
  840.     }
  841.     public function addConversation(Conversation $conversation): self
  842.     {
  843.         if (!$this->conversations->contains($conversation)) {
  844.             $this->conversations->add($conversation);
  845.             $conversation->setProject($this);
  846.         }
  847.         return $this;
  848.     }
  849.     public function removeConversation(Conversation $conversation): self
  850.     {
  851.         if ($this->conversations->removeElement($conversation)) {
  852.             // set the owning side to null (unless already changed)
  853.             if ($conversation->getProject() === $this) {
  854.                 $conversation->setProject(null);
  855.             }
  856.         }
  857.         return $this;
  858.     }
  859.     /**
  860.      * @return Collection<int, Devis>
  861.      */
  862.     public function getDevis(): Collection
  863.     {
  864.         return $this->devis;
  865.     }
  866.     public function addDevi(Devis $devi): self
  867.     {
  868.         if (!$this->devis->contains($devi)) {
  869.             $this->devis->add($devi);
  870.             $devi->setProject($this);
  871.         }
  872.         return $this;
  873.     }
  874.     public function removeDevi(Devis $devi): self
  875.     {
  876.         if ($this->devis->removeElement($devi)) {
  877.             // set the owning side to null (unless already changed)
  878.             if ($devi->getProject() === $this) {
  879.                 $devi->setProject(null);
  880.             }
  881.         }
  882.         return $this;
  883.     }
  884.     /**
  885.      * @return Collection<int, Responsable>
  886.      */
  887.     public function getResponsables(): Collection
  888.     {
  889.         return $this->responsables;
  890.     }
  891.     public function addResponsable(Responsable $responsable): self
  892.     {
  893.         if (!$this->responsables->contains($responsable)) {
  894.             $this->responsables->add($responsable);
  895.             $responsable->setProject($this);
  896.         }
  897.         return $this;
  898.     }
  899.     public function removeResponsable(Responsable $responsable): self
  900.     {
  901.         if ($this->responsables->removeElement($responsable)) {
  902.             // set the owning side to null (unless already changed)
  903.             if ($responsable->getProject() === $this) {
  904.                 $responsable->setProject(null);
  905.             }
  906.         }
  907.         return $this;
  908.     }
  909.     /**
  910.      * @return bool
  911.      */
  912.     public function isAllowedToSigne(): bool
  913.     {
  914.         return $this->allowedToSigne;
  915.     }
  916.     /**
  917.      * @param bool $allowedToSigne
  918.      */
  919.     public function setAllowedToSigne(bool $allowedToSigne): void
  920.     {
  921.         $this->allowedToSigne $allowedToSigne;
  922.     }
  923.     /**
  924.      * @return Collection<int, CollaboratorProject>
  925.      */
  926.     public function getCollaboratorProjects(): Collection
  927.     {
  928.         return $this->collaboratorProjects;
  929.     }
  930.     public function addCollaboratorProject(CollaboratorProject $collaboratorProject): self
  931.     {
  932.         if (!$this->collaboratorProjects->contains($collaboratorProject)) {
  933.             $this->collaboratorProjects->add($collaboratorProject);
  934.             $collaboratorProject->setProject($this);
  935.         }
  936.         return $this;
  937.     }
  938.     public function removeCollaboratorProject(CollaboratorProject $collaboratorProject): self
  939.     {
  940.         if ($this->collaboratorProjects->removeElement($collaboratorProject)) {
  941.             // set the owning side to null (unless already changed)
  942.             if ($collaboratorProject->getProject() === $this) {
  943.                 $collaboratorProject->setProject(null);
  944.             }
  945.         }
  946.         return $this;
  947.     }
  948. }