/**
  * Function to send email and notification when creating jp.
  *
  * @param \Opit\OpitHrm\HiringBundle\Entity\JobPosition $jobPosition
  */
 protected function sendJpMessages(JobPosition $jobPosition)
 {
     $templateVars = array();
     $templateVars['jobPosition'] = $jobPosition;
     $applicationName = $this->container->getParameter('application_name');
     $emailManager = $this->get('opit.component.email_manager');
     $emailManager->setRecipient($jobPosition->getHiringManager()->getEmail());
     $emailManager->setSubject('[' . ($applicationName !== null && $applicationName != 'OPIT-HRM' ? $applicationName : 'OPIT-HRM') . '] - Job position created (' . $jobPosition->getJobPositionId() . ')');
     $emailManager->setBodyByTemplate('OpitOpitHrmHiringBundle:Mail:jobPosition.html.twig', $templateVars);
     $emailManager->sendMail();
     $notificationManager = $this->get('opit.manager.job_position_notification_manager');
     $notificationManager->addNewJobPositionNotification($jobPosition);
 }