symfony / symfony/maker-bundle

Creating a relation to an entity without __toString breaks

Open
#233 2 comments 0 reactions 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

Steps to reproduce:

  1. Create an entity with make:entity
  2. Create another entity, and give it a relation to the first entity
  3. run make:crud for the entity.
  4. visit /<enity>/new

You will be presented with the following error.
image.

The solution would be, to aks what property should be used to display the other entity, when creating a relation to a entity, not implementing __toString.

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

Start by reproducing the failure with make:entity, a relation, and make:crud, then visit the generated entity's /new page. Trace the generated relation field and determine how its display property should be selected; done means the form works for related entities without __toString.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.