src/Service/Finance/ProposalService.php line 38

Open in your IDE?
  1. <?php
  2. namespace App\Service\Finance;
  3. use Symfony\Contracts\Translation\TranslatorInterface;
  4. use App\Service\Kernel\KernelService;
  5. use DateTime;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use App\Entity\Finance\Lead;
  8. use App\Entity\Finance\Proposal;
  9. use App\Entity\Finance\ProposalElement;
  10. use App\Entity\CMS\CMSVacancy;
  11. use App\Service\Kernel\DMSService;
  12. use App\Entity\Finance\SalesCondition;
  13. /**
  14.  * Description of LeadService
  15.  *
  16.  */
  17. class ProposalService {
  18.         private $TranslatorInterface;
  19.         private $entityManager;
  20.         private $kernel_service;
  21.         private $dMSService;
  22.         
  23.     public function __construct(TranslatorInterface $translator,  EntityManagerInterface $entityManager,
  24.         KernelService $kernel_service,
  25.         DMSService $dMSService) {
  26.         $this->TranslatorInterface = $translator;
  27.         $this->entityManager = $entityManager;
  28.         $this->kernel_service = $kernel_service;
  29.         $this->dMSService = $dMSService;
  30.     }
  31.    
  32.     
  33.     public function createProposal($subject, $type, $proposedOn, $contactPerson, $client, $endClient, $comment, $lead=null, $open, $owner, $interview, $interviewDate, $interviewComment, $employee, $intakeprice, $unitprice, $externalId=null, $organization)
  34.     {
  35.         $entityManager = $this->entityManager;
  36.         $dmsservice = $this->dMSService;
  37.         $proposal = new Proposal();
  38.         $proposalElement = new ProposalElement();
  39.         //$date = new DateTime($dateString);
  40.         
  41.         $proposal->setOrganization($organization);
  42.         $proposal->setSubject($subject);
  43.         $proposal->setType($type);
  44.         $proposal->setProposedOn($proposedOn);
  45.         $proposal->setContactPerson($contactPerson);
  46.         $proposal->setClient($client);
  47.         $proposal->setEndClient($endClient);
  48.         $proposal->setOwner($owner);
  49.         $proposal->setComment($comment);
  50.         $proposal->setOrganization($organization);
  51.         $proposal->setOpen($open);
  52.         $proposal->setLead($lead);
  53.         $proposal->setInterview($interview);
  54.         $proposal->setInterviewDate($interviewDate);
  55.         $proposal->setInterviewComment($interviewComment);
  56.         $proposal->setState(0);
  57.         $proposal->setExternalid($externalId);
  58.         
  59.         $entityManager->persist($proposal);
  60.         $entityManager->flush();
  61.         
  62.         $proposalElement->setEmployee($employee);
  63.         $proposalElement->setIntakePrice($intakeprice);
  64.         $proposalElement->setUnitPrice($unitprice);
  65.         $proposalElement->setState(0);
  66.         $proposalElement->setQuantity(0);
  67.         $proposalElement->setProposal($proposal);
  68.         
  69.         $entityManager->persist($proposalElement);
  70.         $entityManager->flush();
  71.         return $proposal;
  72.         
  73.     }
  74.  
  75. }