/** * @param array $data * @param Campaign $campaign * * @return Response */ public function createResponse(array $data, Campaign $campaign) { $response = new Response(); $response->setCampaign($campaign); $response->setGrossAnnualSalary($this->numberFormatter->parse($data["gross_annual_salary"])); $response->setVariableAnnualSalary($this->numberFormatter->parse($data["variable_annual_salary"])); $response->setAnnualSalary($this->numberFormatter->parse($data["annual_salary"])); $response->setSalarySatisfaction($this->numberFormatter->parse($data["salary_satisfaction"])); $response->setStatus($this->enums->getEnums('status')->getIdByLabel($data["status"])); $response->setJobTitle($this->enums->getEnums('job_title')->getIdByLabel($data["job_title"])); $response->setExperience($this->enums->getEnums('experience')->getIdByLabel($data["experience"])); $response->setInitialTraining($this->enums->getEnums('initial_training')->getIdByLabel($data["initial_training"])); $response->setCompanyType($this->enums->getEnums('company_type')->getIdByLabel($data["company_type"])); $response->setCompanySize($this->enums->getEnums('company_size')->getIdByLabel($data["company_size"])); $department = new Departments(); if (in_array($data["company_department"], array_keys($department->getAll()))) { $response->setCompanyDepartment($data["company_department"]); } $response->setJobInterest($this->enums->getEnums('job_interest')->getIdByLabel($data["job_interest"])); $response->setPhpVersion($this->enums->getEnums('php_version')->getIdByLabel($data["php_version"])); $response->setPhpStrength($this->enums->getEnums('php_strength')->getIdByLabel($data["php_strength"])); $response->setHasRecentTraining("oui" === strtolower($data["has_formation"])); $response->setRecentTrainingHadSalaryImpact("oui" === strtolower($data["formation_impact"])); if ("oui" === strtolower($data['has_certification'])) { $this->addCertification($response, explode(', ', $data['certification_list'])); } if (strlen(trim($data["speciality"])) !== 0) { $this->addSpeciality($response, explode(', ', $data['speciality'])); } $response->setGender($this->enums->getEnums('gender')->getIdByLabel($data["gender"])); return $response; }
public function departmentLabel($code) { try { return $this->departements->getLabel($code, true); } catch (\InvalidArgumentException $e) { return $this->translator->trans('report.company_departement.unknown'); } }
public function testSetCompanyDepartmentCorrectInput() { $department = new Collection(); $department_array = $department->getAll(); //Seules les valeurs de 1 à 9 sont réellement problématique, mais ça ne coute pas plus cher for ($i = 1; $i < 20; ++$i) { $response = new \Afup\BarometreBundle\Entity\Response(); $response->setCompanyDepartment($i); $this->boolean(array_key_exists($response->getCompanyDepartment(), $department_array))->isTrue(); } }
/** * {@inheritdoc} */ public function buildQuery(QueryBuilder $queryBuilder, array $values = array()) { if (!array_key_exists($this->getName(), $values) || 0 === count($values[$this->getName()])) { return; } $codes = $values[$this->getName()]; if (in_array('all_but_paris', $codes)) { $departements = new Departments(); $regions = new Regions(); unset($codes[array_search('all_but_paris', $codes)]); $codes = array_merge($codes, array_diff(array_keys($departements->getArrayCopy()), $regions->get(self::ALL_BUT_PARIS_REGION_CODE)->getCodesDepartements())); } if (count($codes)) { $queryBuilder->setParameter('department', $codes, Connection::PARAM_STR_ARRAY)->andWhere('response.companyDepartment IN(:department)'); } }
public function testGetAll() { $collection = new TestedClass(); $this->array($all = $collection->getAll())->string($all['29'])->isEqualTo('Finistère'); }