Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16791 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

<?php

declare(strict_types=1);

namespace LeadersLinked\Form\Organization;

use Laminas\InputFilter\InputFilter;
use Laminas\Db\Adapter\AdapterInterface;
use LeadersLinked\Mapper\CompetencyTypeMapper;
use LeadersLinked\Mapper\MicrolearningTopicMapper;
use LeadersLinked\Model\MicrolearningTopic;
use LeadersLinked\Mapper\JobDescriptionMapper;
use LeadersLinked\Mapper\UserMapper;

class PositionFilter extends InputFilter
{

    /**
     * 
     * @param AdapterInterface $adapter
     */
    public function __construct(AdapterInterface $adapter)
    {
        
        
        $this->add([
            'name' => 'job_description_id',
            'required' => true,
            'validators' => [
                [
                    'name' => \Laminas\Validator\NotEmpty::class,
                ],
                [
                    'name' => \Laminas\Validator\Db\RecordExists::class,
                    'options' => [
                        'adapter' => $adapter,
                        'table' => JobDescriptionMapper::_TABLE,
                        'field' => 'uuid'
                    ]
                ]
            ],
        ]);

        
        $this->add([
            'name' => 'employee_id',
            'required' => true,
            'validators' => [
                [
                    'name' => \Laminas\Validator\NotEmpty::class,
                ],
                [
                    'name' => \Laminas\Validator\Db\RecordExists::class,
                    'options' => [
                        'adapter' => $adapter,
                        'table' => UserMapper::_TABLE,
                        'field' => 'uuid'
                    ]
                ]
            ],
        ]);
        
        $this->add([
            'name' => 'boss_id',
            'required' => false,
            'validators' => [
                [
                    'name' => \Laminas\Validator\NotEmpty::class,
                ],
                [
                    'name' => \Laminas\Validator\Db\RecordExists::class,
                    'options' => [
                        'adapter' => $adapter,
                        'table' => UserMapper::_TABLE,
                        'field' => 'uuid'
                    ]
                ]
            ],
        ]);

        
        $this->add([
            'name' => 'status',
            'required' => false,
            'filters' => [
                ['name' => \Laminas\Filter\StripTags::class],
                ['name' => \Laminas\Filter\StringTrim::class],
            ],
            'validators' =>[
                [
                    'name' =>\Laminas\Validator\NotEmpty::class,
                ],
            ]
        ]);
        
    }
}