Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
15461 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\RecruitmentSelection;
6
 
7
use Laminas\Form\Form;
8
use Laminas\Db\Adapter\AdapterInterface;
9
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
10
 
11
class RecruitmentSelectionApplicationVacancyForm extends Form
12
{
13
 
14
    /**
15
     *
16
     * @param AdapterInterface $adapter
17
     * @param int $company_id
18
     */
19
    public function __construct($adapter, $company_id)
20
    {
21
        parent::__construct();
22
        $this->setInputFilter(new RecruitmentSelectionApplicationVacancyFilter($adapter, $company_id));
23
 
24
 
25
 
26
        $this->add([
27
            'name' => 'vacancy_id',
28
            'type' => \Laminas\Form\Element\Select::class,
29
            'attributes' => [
30
                'id' => 'vacancy_id',
31
            ],
32
            'options' => [
33
                'value_options' => $this->getSelectFormOptions($adapter, $company_id)
34
            ]
35
        ]);
36
 
37
 
38
 
39
 
40
    }
41
 
42
    /**
43
     *
44
     * @param AdapterInterface $adapter
45
     */
46
    private function getSelectFormOptions($adapter, $company_id)
47
    {
48
        $options = [];
49
 
50
        $mapper = RecruitmentSelectionVacancyMapper::getInstance($adapter);
51
        $records = $mapper->fetchAllActiveByCompanyId($company_id);
52
 
53
        foreach($records as $record)
54
        {
55
            $options[$record->uuid] = $record->name;
56
        }
57
        return $options;
58
    }
59
 
60
 
61
}