SuiteCRM-Core/Api/V8/Param/CreateModuleDataParams.php
Dillon-Brown 8e4cc94994 Squashed 'public/legacy/' content from commit 817a12dc0
git-subtree-dir: public/legacy
git-subtree-split: 817a12dc0c30c189f56d5cb1f7dc37a9631bdbe3
2021-03-31 15:37:32 +01:00

56 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;
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,
]
);
}
}