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小节:

评论 (写第一个评论)