Proyectos de Subversion LeadersLinked - Antes de SPA

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\Job;
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
use LeadersLinked\Mapper\UserProfileMapper;
13
 
14
class ApplyForm extends Form
15
{
16
    /**
17
     *
18
     * @param AdapterInterface $adapter
19
     * @param int $user_id
20
     */
21
    public function __construct($adapter, $user_id)
22
    {
23
        parent::__construct();
24
        $this->setInputFilter(new ApplyFilter($adapter));
25
 
26
        $this->add([
27
            'name' => 'user_profile_id',
28
            'type' => \Laminas\Form\Element\Select::class,
29
            'options' => [
30
                'value_options' => $this->optionsProfiles($adapter, $user_id),
31
            ],
32
            'attributes' => [
33
                'id' => 'user_profile_id',
34
            ]
35
        ]);
36
    }
37
 
38
    /**
39
     *
40
     * @param AdapterInterface $adapter
41
     * @param int $user_id
42
     * @param LoggerInterface $logger
43
     * @return array
44
     */
45
    private function optionsProfiles($adapter, $user_id)
46
    {
47
        $userProfileMapper = UserProfileMapper::getInstance($adapter);
48
        $userProfiles = $userProfileMapper->fetchAllByUserId($user_id);
49
 
50
        $options = [];
51
        foreach($userProfiles as $userProfile)
52
        {
53
            $options[$userProfile->uuid] = $userProfile->name;
54
        }
55
 
56
        return $options;
57
    }
58
 
59
 
60
}