mirror of
https://github.com/salesagility/SuiteCRM.git
synced 2024-12-28 23:08:09 +00:00
29 lines
791 B
PHP
29 lines
791 B
PHP
<?php
|
|
namespace Api\V8\Param\Options;
|
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
#[\AllowDynamicProperties]
|
|
class ModuleName extends BaseOption
|
|
{
|
|
public const REGEX_MODULE_NAME_PATTERN = '/^(\d|\W)|\W/';
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function add(OptionsResolver $resolver)
|
|
{
|
|
$resolver
|
|
->setRequired('moduleName')
|
|
->setAllowedTypes('moduleName', 'string')
|
|
->setAllowedValues('moduleName', $this->validatorFactory->createClosure([
|
|
new Assert\NotBlank(),
|
|
new Assert\Regex([
|
|
'pattern' => self::REGEX_MODULE_NAME_PATTERN,
|
|
'match' => false,
|
|
]),
|
|
]));
|
|
}
|
|
}
|