8000 Rethink the namespace for Entity Bundle Classes · Issue #74 · Chi-teck/drupal-code-generator · GitHub
[go: up one dir, main page]

Skip to content
Rethink the namespace for Entity Bundle Classes #74
@drubb

Description

@drubb

For now, entity bundle classes generated by DCG 2 are placed in the namespace Drupal\mymodule\Entity\Bundle:

<?php

namespace Drupal\mymodule\Entity\Bundle;

use Drupal\node\Entity\Node;

/**
 * A bundle class for node entities.
 */
class ArticleBundle extends Node {
...
}

However, most documentation and blog posts I've seen for now favor putting them directly in the 'Entity' namespace. Here's an excellent example: https://www.hashbangcode.com/article/drupal-9-entity-bundle-classes.

This is highly opinionated, but IMHO DCG should follow established best practices, so I'd suggest changing the namespace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0