buildCommonValidation example

/** * @internal */
    public function __construct(private readonly SystemConfigService $systemConfigService)
    {
    }

    public function create(SalesChannelContext $context): DataValidationDefinition
    {
        $definition = new DataValidationDefinition('address.create');

        $this->buildCommonValidation($definition$context);

        return $definition;
    }

    public function update(SalesChannelContext $context): DataValidationDefinition
    {
        $definition = new DataValidationDefinition('address.update');

        $this->buildCommonValidation($definition$context)
            ->add('id', new NotBlank()new EntityExists(['context' => $context->getContext(), 'entity' => 'customer_address']));

        
Home | Imprint | This part of the site doesn't use cookies.