Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form;
6
 
7
use Laminas\Form\Form;
8
use Laminas\Db\Adapter\AdapterInterface;
9
use Laminas\Log\LoggerInterface;
10
use LeadersLinked\Mapper\CompanySizeMapper;
11
use LeadersLinked\Mapper\IndustryMapper;
12
 
13
class CompanyProfileCompanySizeForm extends Form
14
{
15
    /**
16
     *
17
     * @param AdapterInterface $adapter
18
     */
19
    public function __construct($adapter)
20
    {
21
        parent::__construct();
22
        $this->setInputFilter(new CompanyProfileCompanySizeFilter($adapter));
23
 
24
        $this->add([
25
            'name' => 'company_size_id',
26
            'type' => \Laminas\Form\Element\Select::class,
27
            'options' => [
28
                'value_options' => $this->optionsCompanySize($adapter),
29
            ],
30
            'attributes' => [
31
                'id' => 'company_size_id',
32
            ]
33
        ]);
34
    }
35
 
36
    /**
37
     *
38
     * @param AdapterInterface $adapter
39
     * @param LoggerInterface $logger
40
     * @return array
41
     */
42
    private function optionsCompanySize($adapter)
43
    {
44
        $companySizeMapper = CompanySizeMapper::getInstance($adapter);
15086 efrain 45
        $companySizes = $companySizeMapper->fetchAllActive();
1 www 46
 
47
        $options = [];
48
        foreach($companySizes as $companySize)
49
        {
50
            $options[$companySize->uuid] = $companySize->name . ' (' . $companySize->minimum_no_of_employee . ' - ' . $companySize->maximum_no_of_employee . ')';
51
        }
52
 
53
        return $options;
54
    }
55
 
56
 
57
}