Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

ImmutablePropertiesConstraint.php

Namespace

Drupal\Core\Entity\Plugin\Validation\Constraint

File

core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ImmutablePropertiesConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Core\Entity\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;

/**
 * Checks if config entity properties have been changed.
 */
class ImmutablePropertiesConstraint extends SymfonyConstraint {
    
    /**
     * The error message if an immutable property has been changed.
     *
     * @var string
     */
    public string $message = "The '@name' property cannot be changed.";
    
    /**
     * The names of the immutable properties.
     *
     * @var string[]
     */
    public array $properties = [];
    
    /**
     * {@inheritdoc}
     */
    public function getDefaultOption() : ?string {
        return 'properties';
    }
    
    /**
     * {@inheritdoc}
     */
    public function getRequiredOptions() : array {
        return [
            'properties',
        ];
    }

}

Classes

Title Deprecated Summary
ImmutablePropertiesConstraint Checks if config entity properties have been changed.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal