[PR #208] [CLOSED] Allow entity name filtering by regexp in doctrine:mapping:import. #7866

Closed
opened 2026-01-22 15:57:16 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/208
Author: @thunderer
Created: 11/30/2011
Status: Closed

Base: masterHead: master


📝 Commits (2)

  • c1f4849 allow entity name filtering by regexp in doctrine:mapping:import
  • f3ae9fb changed regexp delimiters from / to # as it could conflict with namespaced entity names

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/Tools/Console/MetadataFilter.php (+2 -1)

📄 Description

While working on a Symfony2 project I found it extremely useful to be able to filter entity names by regexp when importing entities to YAML metadata. This small commit makes it possible without any BC breaks or something. I've written about it on my blog: http://blog.kowalczyk.cc/2011/11/11/symfony2-importing-entity-mapping-data-using-regular-expression-filters/ .

Without this commit:

./app/console doctrine:mapping:import ThunderSampleBundle yml --force --filter="Category" --filter="User"

Imports everything that contains "Category" or "User" in its name. With my commit:

./app/console doctrine:mapping:import ThunderSampleBundle yml --force --filter="^Category" --filter="^User$"

Imports only wanted entities. And you can use both ways simultaneously, because preg_match("/{name}/") does the same as strpos("{name}");.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/208 **Author:** [@thunderer](https://github.com/thunderer) **Created:** 11/30/2011 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (2) - [`c1f4849`](https://github.com/doctrine/orm/commit/c1f4849bcc45ab602cd20588e2da772cd749793b) allow entity name filtering by regexp in doctrine:mapping:import - [`f3ae9fb`](https://github.com/doctrine/orm/commit/f3ae9fbc80538e91c9c74001a68c4c20ec43734a) changed regexp delimiters from / to # as it could conflict with namespaced entity names ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Tools/Console/MetadataFilter.php` (+2 -1) </details> ### 📄 Description While working on a Symfony2 project I found it extremely useful to be able to filter entity names by regexp when importing entities to YAML metadata. This small commit makes it possible without any BC breaks or something. I've written about it on my blog: http://blog.kowalczyk.cc/2011/11/11/symfony2-importing-entity-mapping-data-using-regular-expression-filters/ . Without this commit: ``` Bash ./app/console doctrine:mapping:import ThunderSampleBundle yml --force --filter="Category" --filter="User" ``` Imports everything that contains "Category" or "User" in its name. With my commit: ``` Bash ./app/console doctrine:mapping:import ThunderSampleBundle yml --force --filter="^Category" --filter="^User$" ``` Imports only wanted entities. And you can use both ways simultaneously, because `preg_match("/{name}/")` does the same as `strpos("{name}");`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:57:16 +01:00
admin closed this issue 2026-01-22 15:57:16 +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#7866