0
0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2024-12-28 14:58:08 +00:00
salesagility_SuiteCRM/Api/V8/Param/CreateModuleDataParams.php
2023-07-18 15:53:08 +01:00

58 lines
1.3 KiB
PHP

<?php
namespace Api\V8\Param;
use Api\V8\Param\Options as ParamOption;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints as Assert;
#[\AllowDynamicProperties]
class CreateModuleDataParams extends BaseParam
{
/**
* @return string
*/
public function getType()
{
return $this->parameters['type'];
}
/**
* @return string|null
*/
public function getId()
{
return isset($this->parameters['id']) ? $this->parameters['id'] : null;
}
/**
* @return array
*/
public function getAttributes()
{
return isset($this->parameters['attributes']) ? $this->parameters['attributes'] : [];
}
/**
* @inheritdoc
*/
protected function configureParameters(OptionsResolver $resolver)
{
// need to make this more simple
$resolver
->setDefined('id')
->setAllowedTypes('id', 'string')
->setAllowedValues('id', $this->validatorFactory->createClosure([
new Assert\NotBlank(),
new Assert\Uuid(['strict' => false]),
]));
$this->setOptions(
$resolver,
[
ParamOption\Type::class,
ParamOption\Attributes::class,
]
);
}
}