symfony / symfony/maker-bundle
An entity with a many-to-many relationship to itself doesn't create the relationship properly
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 427
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 20
Description
e.g. Categories have a child/parent relationship, so I've added a parents property to an existing category, with the type of relation, it asks for the entity type, then the property name. When adding to the class, the maker code does not generate the inverse of the relationship on the same model (it doesn't ask), so a migration does not then generate the necessary middle table. Currently, it's necessary to go in and add the inverse of the relationship yourself.
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
Trace the maker code that adds a many-to-many relation and compare how it handles an inverse relation on the same entity. Check the generated class and migration for a self-referencing Categories relationship; done means the inverse is generated and the migration creates the required middle table.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100