As we saw in the preceding chapter, when looking at the Node and NodeType entity types, entity type definitions belong inside the Entity folder of our module's namespace. In there, we will create a class called Product, which will have an annotation at the top to tell Drupal this is a content entity type. This is the most important part in defining a new entity type:
namespace Drupal\products\Entity;use Drupal\Core\Entity\ContentEntityBase;use Drupal\Core\Entity\EntityChangedTrait;use Drupal\Core\Entity\EntityTypeInterface;use Drupal\Core\Field\BaseFieldDefinition;/** * Defines the Product entity. * * @ContentEntityType( * id = "product", * label = @Translation("Product"), * handlers = { * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", ...