AutorÃa | Ultima modificación | Ver Log |
<?php
declare(strict_types=1);
namespace LeadersLinked\Form\Microlearning;
use Laminas\InputFilter\InputFilter;
use Laminas\Db\Adapter\AdapterInterface;
use LeadersLinked\Mapper\CompetencyTypeMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserFunctionMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserGroupMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserSectorMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserCompanyMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserInstitutionMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserPartnerMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserStudentTypeMapper;
use LeadersLinked\Mapper\MicrolearningExtendUserProgramMapper;
class ExtendUserMicrolearningFilter extends InputFilter
{
/**
*
* @param AdapterInterface $adapter
* @param int $company_id
*/
public function __construct(AdapterInterface $adapter, $company_id)
{
$this->add([
'name' => 'function_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserFunctionMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
$this->add([
'name' => 'group_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserGroupMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
$this->add([
'name' => 'sector_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserSectorMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
$this->add([
'name' => 'company_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserCompanyMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
$this->add([
'name' => 'institution_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserInstitutionMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
$this->add([
'name' => 'partner_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserPartnerMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
$this->add([
'name' => 'program_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserProgramMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
$this->add([
'name' => 'student_type_id',
'required' => false,
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \LeadersLinked\Validator\RecordExistsMultiFields::class,
'options' => [
'adapter' => $adapter,
'table' => MicrolearningExtendUserStudentTypeMapper::_TABLE,
'field' => 'uuid',
'custom_fields' => [
'company_id' => $company_id
]
]
]
],
]);
}
}