symfony / symfony/maker-bundle
Drop nullable-question for `simple_array`, `array` and `json`?
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 427
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 20
Description
When answering "yes" to the nullable-question ("Can this field be null in the database (nullable)"), the result is:
/**
* @ORM\Column(type="json", nullable=true)
*/
private $col1 = [];
/**
* @ORM\Column(type="simple_array", nullable=true)
*/
private $col2 = [];
/**
* @ORM\Column(type="array", nullable=true)
*/
private $col3 = [];
But if each new entity is instantiated with an empty array ([]), I only see two ways how this could ever be null in the database:
- You set it to
nullyourself, explicitly:(new Foo())->setCol1(null) - You enter it manually in the database, without Doctrine
Both seem to be "special" cases. So I'm wondering if it wouldn't be better to omit the nullable-question for these types, and just silently default to non-nullable - requiring those few people who need this, to manually add it.
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 by locating the nullable-question handling for the simple_array, array, and json types and any tests covering their generated annotations. Review the existing discussion before deciding whether these types should omit the question or preserve an explicit nullable option; done means the behavior and its tests clearly reflect the agreed decision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100