symfony / symfony/maker-bundle
[RFC] Provide db prefix in make:entity
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 427
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 20
Description
Would a PR for a feature to provide a db table name prefix be accepted?
A use case is that a user would like to prefix his tables with a certain prefix. Therefor we could add the @ORM\Table annotation if a prefix is defined. Together with the prefix we could generate the db name based on the namingstrategy setup in the doctrine config.
Some pseudo code for a method in the doctrine helper:
public function getTableName($className)
{
$em = $this->getRegistry()->getManagerForClass($className);
if (null === $em) {
$em = $this->getRegistry()->getManager();
}
$tableName = $em->getConfiguration()->getNamingStrategy()->classToTableName($className);
return $tableName;
}
That way we can reliable determin the table name and add the given prefix. If no prefix is defined I would suggest to not add the @Table annotation
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the make:entity command and the Doctrine helper described in the issue, then inspect how Doctrine configuration and naming strategies are accessed. Done should mean a configured table prefix is reflected in generated entities using the configured naming strategy, while no prefix leaves the @Table annotation absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100