Rev 4113 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
<?php
declare(strict_types=1);
namespace LeadersLinked\Form\AccountSetting;
use Laminas\InputFilter\InputFilter;
class BasicFilter extends InputFilter
{
public function __construct()
{
$this->add([
'name' => 'phone',
'required' => true,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
'validators' =>[
[
'name' =>\Laminas\Validator\NotEmpty::class,
],
[
'name' => \Laminas\Validator\StringLength::class,
'options' => [
'encoding' => 'UTF-8',
'max' => 18
],
],
]
]);
$this->add([
'name' => 'first_name',
'required' => true,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
'validators' =>[
[
'name' =>\Laminas\Validator\NotEmpty::class,
],
[
'name' => \Laminas\Validator\StringLength::class,
'options' => [
'encoding' => 'UTF-8',
'max' => 64
],
],
]
]);
$this->add([
'name' => 'last_name',
'required' => true,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
'validators' =>[
[
'name' =>\Laminas\Validator\NotEmpty::class,
],
[
'name' => \Laminas\Validator\StringLength::class,
'options' => [
'encoding' => 'UTF-8',
'max' => 64
],
],
]
]);
$this->add([
'name' => 'gender',
'required' => false,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
'validators' =>[
[
'name' =>\Laminas\Validator\NotEmpty::class,
],
[
'name' => \Laminas\Validator\StringLength::class,
'options' => [
'encoding' => 'UTF-8',
'max' => 1
],
],
]
]);
$this->add([
'name' => 'email',
'required' => true,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
'validators' => [
[
'name' => \Laminas\Validator\StringLength::class,
'options' => [
'encoding' => 'UTF-8',
'max' => 64,
],
],
[
'name' => \Laminas\Validator\NotEmpty::class,
],
[
'name' => \Laminas\Validator\EmailAddress::class,
],
/*[
'name' => \Laminas\Validator\Db\RecordExists::class,
'options' => [
'table' => UserMapper::_TABLE,
'field' => 'email',
'adapter' => $adapter,
],
],*/
],
]);
$this->add([
'name' => 'timezone',
'required' => true,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
'validators' => [
[
'name' => \Laminas\Validator\NotEmpty::class,
],
],
]);
$this->add([
'name' => 'is_adult',
'required' => false,
'filters' => [
['name' => \Laminas\Filter\StripTags::class],
['name' => \Laminas\Filter\StringTrim::class],
],
]);
}
}