[PR #1120] [DDC-3205] Metadata info #9176

Open
opened 2026-01-22 16:03:29 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/1120

State: closed
Merged: No


This PR adds support for showing the metadata for a single entity to the orm:info command.

  • The original behavior is preserved (running without arguments validates and lists all the entity names)
  • The output is formatted using the TableHelper if it is available (Symfony 2.4+). If the TableHelper is not available
    it will format simply with field: value.
  • Partial regex matches are accepted, e.g. mapping:info Attraction, mapping:info Attraction.*

E.g.:

$ php app/console doctrine:mapping:info "Sulu\Bundle\ContactBundle\Entity\Count"
+-------------------------------+-----------------------------------------------------------------------------------------------+
| Field                         | Value                                                                                         |
+-------------------------------+-----------------------------------------------------------------------------------------------+
| Name                          | Sulu\Bundle\TagBundle\Entity\Tag                                                              |
| Root entity name              | Sulu\Bundle\TagBundle\Entity\Tag                                                              |
| Custom generator definition   | None                                                                                          |
| Custom repository class       | Sulu\Bundle\TagBundle\Entity\TagRepository                                                    |
| Mapped super class?           | Empty                                                                                         |
| Embedded class?               | Empty                                                                                         |
| Parent classes                | Empty                                                                                         |
| Sub classes                   | Empty                                                                                         |
| Embedded classes              | Empty                                                                                         |
| Named queries                 | Empty                                                                                         |
| Named native queries          | Empty                                                                                         |
| SQL result set mappings       | Empty                                                                                         |
| Identifier                    | ["id"]                                                                                        |
| Inheritance type              | 1                                                                                             |
| Discriminator column          | None                                                                                          |
| Discriminator value           | None                                                                                          |
| Discriminator map             | Empty                                                                                         |
| Generator type                | 4                                                                                             |
| Table                         | {"name":"ta_tags"}                                                                            |
| Composite identifier?         | Empty                                                                                         |
| Foreign identifier?           | Empty                                                                                         |
| Sequence generator definition | None                                                                                          |
| Table generator definition    | None                                                                                          |
| Change tracking policy        | 1                                                                                             |
| Versioned?                    | None                                                                                          |
| Version field                 | None                                                                                          |
| Read only?                    | Empty                                                                                         |
| Entity listeners              | Empty                                                                                         |
| Association mappings:         |                                                                                               |
|   creator                     |                                                                                               |
|     fieldName                 | creator                                                                                       |
|     targetEntity              | Sulu\Bundle\SecurityBundle\Entity\User                                                        |
|     joinColumns               | [{"name":"idUsersCreator","referencedColumnName":"id","nullable":true,"onDelete":"SET NULL"}] |
|     type                      | 2                                                                                             |
|     mappedBy                  | Null                                                                                          |
|     inversedBy                | Null                                                                                          |
|     isOwningSide              | 1                                                                                             |
|     sourceEntity              | Sulu\Bundle\TagBundle\Entity\Tag                                                              |
|     fetch                     | 2                                                                                             |
|     cascade                   | Empty                                                                                         |
|     isCascadeRemove           | Empty                                                                                         |
|     isCascadePersist          | Empty                                                                                         |
|     isCascadeRefresh          | Empty                                                                                         |
|     isCascadeMerge            | Empty                                                                                         |
|     isCascadeDetach           | Empty                                                                                         |
|     sourceToTargetKeyColumns  | {"idUsersCreator":"id"}                                                                       |
|     joinColumnFieldNames      | {"idUsersCreator":"idUsersCreator"}                                                           |
|     targetToSourceKeyColumns  | {"id":"idUsersCreator"}                                                                       |
|     orphanRemoval             | Empty                                                                                         |
| Field mappings:               |                                                                                               |
|   name                        |                                                                                               |
|     fieldName                 | name                                                                                          |
|     type                      | string                                                                                        |
|     columnName                | name                                                                                          |
|     unique                    | 1                                                                                             |
|   created                     |                                                                                               |
|     fieldName                 | created                                                                                       |
|     type                      | datetime                                                                                      |
|     columnName                | created                                                                                       |
+-------------------------------+-----------------------------------------------------------------------------------------------+
**Original Pull Request:** https://github.com/doctrine/orm/pull/1120 **State:** closed **Merged:** No --- This PR adds support for showing the metadata for a single entity to the `orm:info` command. - The original behavior is preserved (running without arguments validates and lists all the entity names) - The output is formatted using the `TableHelper` if it is available (Symfony 2.4+). If the TableHelper is not available it will format simply with `field: value`. - Partial regex matches are accepted, e.g. `mapping:info Attraction`, `mapping:info Attraction.*` E.g.: ``` bash $ php app/console doctrine:mapping:info "Sulu\Bundle\ContactBundle\Entity\Count" +-------------------------------+-----------------------------------------------------------------------------------------------+ | Field | Value | +-------------------------------+-----------------------------------------------------------------------------------------------+ | Name | Sulu\Bundle\TagBundle\Entity\Tag | | Root entity name | Sulu\Bundle\TagBundle\Entity\Tag | | Custom generator definition | None | | Custom repository class | Sulu\Bundle\TagBundle\Entity\TagRepository | | Mapped super class? | Empty | | Embedded class? | Empty | | Parent classes | Empty | | Sub classes | Empty | | Embedded classes | Empty | | Named queries | Empty | | Named native queries | Empty | | SQL result set mappings | Empty | | Identifier | ["id"] | | Inheritance type | 1 | | Discriminator column | None | | Discriminator value | None | | Discriminator map | Empty | | Generator type | 4 | | Table | {"name":"ta_tags"} | | Composite identifier? | Empty | | Foreign identifier? | Empty | | Sequence generator definition | None | | Table generator definition | None | | Change tracking policy | 1 | | Versioned? | None | | Version field | None | | Read only? | Empty | | Entity listeners | Empty | | Association mappings: | | | creator | | | fieldName | creator | | targetEntity | Sulu\Bundle\SecurityBundle\Entity\User | | joinColumns | [{"name":"idUsersCreator","referencedColumnName":"id","nullable":true,"onDelete":"SET NULL"}] | | type | 2 | | mappedBy | Null | | inversedBy | Null | | isOwningSide | 1 | | sourceEntity | Sulu\Bundle\TagBundle\Entity\Tag | | fetch | 2 | | cascade | Empty | | isCascadeRemove | Empty | | isCascadePersist | Empty | | isCascadeRefresh | Empty | | isCascadeMerge | Empty | | isCascadeDetach | Empty | | sourceToTargetKeyColumns | {"idUsersCreator":"id"} | | joinColumnFieldNames | {"idUsersCreator":"idUsersCreator"} | | targetToSourceKeyColumns | {"id":"idUsersCreator"} | | orphanRemoval | Empty | | Field mappings: | | | name | | | fieldName | name | | type | string | | columnName | name | | unique | 1 | | created | | | fieldName | created | | type | datetime | | columnName | created | +-------------------------------+-----------------------------------------------------------------------------------------------+ ```
admin added the pull-request label 2026-01-22 16:03:29 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9176