symfony / symfony/maker-bundle

An entity with a many-to-many relationship to itself doesn't create the relationship properly

Open
#219 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.