11.2 实体注解

龷龶龵龳龯龫龩龧龦龵龳龯龫龢龟龛龘龔龐龎龌龋龊龆

龎龅龂龁龊齾齺齸齴齱齯core/modules/user/src/Entity/User.php

<?php

namespace Drupal\user\Entity;

use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Language\LanguageInterface;
use Drupal\user\RoleInterface;
use Drupal\user\UserInterface;

/**
 * Defines the user entity class.
 *
 * The base table name here is plural, despite Drupal table naming standards,
 * because "user" is a reserved word in many databases.
 *
 * @ContentEntityType(
 *   id = "user",
 *   label = @Translation("User"),
 *   handlers = {
 *     "storage" = "Drupal\user\UserStorage",
 *     "storage_schema" = "Drupal\user\UserStorageSchema",
 *     "access" = "Drupal\user\UserAccessControlHandler",
 *     "list_builder" = "Drupal\user\UserListBuilder",
 *     "views_data" = "Drupal\user\UserViewsData",
 *     "route_provider" = {
 *       "html" = "Drupal\user\Entity\UserRouteProvider",
 *     },
 *     "form" = {
 *       "default" = "Drupal\user\ProfileForm",
 *       "cancel" = "Drupal\user\Form\UserCancelForm",
 *       "register" = "Drupal\user\RegisterForm"
 *     },
 *     "translation" = "Drupal\user\ProfileTranslationHandler"
 *   },
 *   admin_permission = "administer users",
 *   base_table = "users",
 *   data_table = "users_field_data",
 *   label_callback = "user_format_name",
 *   translatable = TRUE,
 *   entity_keys = {
 *     "id" = "uid",
 *     "langcode" = "langcode",
 *     "uuid" = "uuid"
 *   },
 *   links = {
 *     "canonical" = "/user/{user}",
 *     "edit-form" = "/user/{user}/edit",
 *     "cancel-form" = "/user/{user}/cancel",
 *     "collection" = "/admin/people",
 *   },
 *   field_ui_base_route = "entity.user.admin_form",
 *   common_reference_target = TRUE
 * )
 */
class User extends ContentEntityBase implements UserInterface {
...
}

龔龐黯黭黬齾黨黤黡黟黜

  • id: 龵龳龯龫黗齾黖黕黓龆
  • label: 龵龳黖黒黭黐UI齱@Translation黏黎黌黋黈黇黅龆
  • handlers: 黂黀麽齱龵麼龵龳龊麻麸麶麴龆
  • admin_permission: 龵龳龊麲黀麮麭龆
  • base_table: 龵龳龊麬麩黏龆
  • data_table: 龵龳龊麥麡黏龆
  • translatable: 龵龳龟麞黋黈黇黅龆
  • entity_keys: 龵龳黟龊麥麜龆
  • links: 黯黭URI麛麗麓麑龊Link麛麗齱麎龟齾麍麥麜龆
  • field_ui_base_route: 麌齺UI龊麬麉麈麇龆

本书共79小节:

评论 (写第一个评论)