/**
  * Add a job to the user history.
  *
  * @param Job $job
  */
 protected function addJobToHistory(Job $job)
 {
     $session = $this->getRequest()->getSession();
     $ids = $session->get('job_history', array());
     if (!in_array($job->getId(), $ids)) {
         array_unshift($ids, $job->getId());
         $session->set('job_history', array_slice($ids, 0, 3));
     }
 }
Ejemplo n.º 2
0
 /**
  * Add addtional Jobs so we can test record limits and pagers.
  *
  * @param Doctrine\ORM\EntityManager $manager
  * @param Job $job
  */
 protected function duplicateLastJob($manager, $job)
 {
     for ($i = 100; $i <= 130; $i++) {
         $jobClone = clone $job;
         $jobClone->setCompany(sprintf($job->getCompany(), $i));
         $jobClone->setHowToApply(sprintf($job->getHowToApply(), $i));
         $jobClone->setToken(sprintf($job->getToken(), $i));
         $manager->persist($jobClone);
         $manager->flush();
     }
 }
Ejemplo n.º 3
0
 public function buildForm(FormBuilder $builder, array $options)
 {
     $builder->add('category', 'entity', array('class' => 'Jobeet2Bundle:Category', 'required' => true, 'empty_value' => ''));
     $types = Job::getTypes();
     $builder->add('type', 'choice', array('choices' => $types, 'required' => true, 'expanded' => true));
     $builder->add('company');
     $builder->add('logo', 'file', array('required' => false));
     $builder->add('url', 'url');
     $builder->add('position');
     $builder->add('location');
     $builder->add('description', null, array('required' => true));
     $builder->add('howToApply', null, array('label' => 'How to apply ?'));
     $builder->add('isPublic', null, array('label' => 'Is public ?'));
     $builder->add('email', 'email');
 }
 /**
  * Main load function.
  *
  * @param Doctrine\Common\Persistence\ObjectManager $manager
  */
 function load(ObjectManager $manager)
 {
     $affiliates = $this->getModelFixtures();
     // Now iterate thought all fixtures
     foreach ($jobs['Job'] as $reference => $columns) {
         // Create our new Job entity
         $job = new Job();
         // Assign category from the fixtures references
         $category = $this->getReference('Category_' . $columns['Category']);
         $job->setCategory($category);
         // Now assign standart values
         $job->setType(isset($columns['type']) ? $columns['type'] : null);
         $job->setCompany($columns['company']);
         $job->setLogo(isset($columns['logo']) ? $columns['logo'] : null);
         $job->setLocation($columns['location']);
         $job->setUrl(isset($columns['url']) ? $columns['url'] : null);
         $job->setPosition($columns['position']);
         $job->setDescription($columns['description']);
         $job->setHowToApply($columns['how_to_apply']);
         $job->setIsPublic($columns['is_public']);
         $job->setIsActivated($columns['is_activated']);
         $job->setToken($columns['token']);
         $job->setEmail($columns['email']);
         $manager->persist($job);
         $manager->flush();
         // Add a reference to be able to use this object in others loaders
         $this->addReference('Job_' . $reference, $job);
     }
     // Insert additional
     $this->duplicateLastJob($manager, $job);
 }