Example #1
0
 public function testSetDeletedAt()
 {
     $company = new Company();
     $dateTime = new \DateTime();
     $company->setDeletedAt($dateTime);
     $this->assertEquals($dateTime, $company->getDeletedAt());
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $faker = Factory::create();
     for ($i = 0; $i < 10; $i++) {
         $company = new Company();
         $company->setName($faker->company);
         $this->addReference('company-' . $i, $company);
         $manager->persist($company);
     }
     $manager->flush();
 }
Example #3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     // First company
     $company = new Company();
     $company->setName('Google');
     $manager->persist($company);
     $manager->flush();
     $this->addReference('google', $company);
     // Second company
     $company = new Company();
     $company->setName('Microsoft');
     $manager->persist($company);
     $manager->flush();
     $this->addReference('microsoft', $company);
     // Third company
     $company = new Company();
     $company->setName('Apple');
     $company->setDeletedAt(new \DateTime());
     $manager->persist($company);
     $manager->flush();
     $this->addReference('apple', $company);
 }
Example #4
0
 /**
  * Get paginated results.
  *
  * @param int           $page       Current page
  * @param int           $limit      Items per page limit
  * @param array         $sortby     Sorting options
  *
  * @return \Knp\Component\Pager\Pagination\PaginationInterface Returns a filtered paginator
  */
 public function getPaginatedResults(Company $company, $page = 1, $limit = 15, array $sortby = array())
 {
     $qb = $this->objectManager->createQueryBuilder(self::ENTITY_ALIAS)->select(self::ENTITY_ALIAS)->from(self::ENTITY_CLASS, self::ENTITY_ALIAS)->where(self::ENTITY_ALIAS . '.company = :company_id')->setParameter('company_id', $company->getId());
     return $this->getPaginator()->paginate($qb, $page, $limit, $sortby);
 }
Example #5
0
 /**
  * @ParamConverter("company", class="JumphClientBundle:Company", options={"id" = "companyId"})
  * @ParamConverter("employee", class="JumphClientBundle:Employee", options={"id" = "employeeId"})
  *
  * Delete employee
  *
  * @param Company $company
  * @param Employee $employee
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse A Response instance
  */
 public function deleteAction(Company $company, Employee $employee)
 {
     $employeeManager = $this->get('jumph_client.employee_manager');
     $employeeManager->delete($employee);
     $alertMessage = $this->get('jumph_app.alert_message');
     $alertMessage->success('Employee deleted!');
     return $this->redirect($this->generateUrl('jumph_employee_overview', array('companyId' => $company->getId())));
 }
 /**
  * @ParamConverter("company", class="JumphClientBundle:Company", options={"id" = "companyId"})
  * @ParamConverter("employee", class="JumphClientBundle:Employee", options={"id" = "employeeId"})
  *
  * Delete employee
  *
  * @param Company $company
  * @param Employee $employee
  *
  * @return RedirectResponse A Response instance
  */
 public function deleteAction(Company $company, Employee $employee)
 {
     $employeeManager = $this->get('jumph_client.employee_manager');
     $employeeManager->delete($employee);
     $dispatcher = $this->container->get('event_dispatcher');
     $dispatcher->dispatch(ClientEvents::DELETE_EMPLOYEE, new Event());
     $alertMessage = $this->get('jumph_app.alert_message');
     $alertMessage->success($this->get('translator')->trans('client.employee.flash.delete'));
     return $this->redirect($this->generateUrl('jumph_client_employee_overview', array('companyId' => $company->getId())));
 }
Example #7
0
 /**
  * Returns a filtered paginator.
  *
  * @param Company $company
  * @param FormInterface $form Filter form
  * @param int $page Page number
  * @param int $limit Limit per page
  * @param array $options Pagination options
  *
  * @return PaginationInterface
  */
 public function getPaginatedResults(Company $company, FormInterface $form, $page = 1, $limit = 100, array $options = array())
 {
     $qb = $this->createQueryBuilder($form)->where(EmployeeManager::ENTITY_ALIAS . '.company = :company_id')->setParameter('company_id', $company->getId());
     return $this->getPaginator()->paginate($qb, $page, $limit, $options);
 }