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

评论 (写第一个评论)