Skip to content

the product category must be nullable #10031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2018
Merged

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jul 9, 2018

At first I wanted to sync the return type of getCategory() with the changes done in #9951. Though while looking at the rest of the chapter I noticed that we indeed call setCategory() with null in a follow-up example. So I decided to allow the property to become null instead.

@xabbuh xabbuh added this to the 4.0 milestone Jul 9, 2018
@@ -146,7 +146,7 @@ the ``Product`` entity (and getter & setter methods):

/**
* @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="products")
* @ORM\JoinColumn(nullable=false)
* @ORM\JoinColumn(nullable=true)
Copy link
Member

@yceruto yceruto Jul 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, the annotation can be removed (it's already the default value)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yceruto you meant remove the entire @ORM\JoinColumn instead of leaving it empty @ORM\JoinColumn(), right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, completely.

@xabbuh xabbuh force-pushed the pr-9951 branch 2 times, most recently from 3fe88eb to 27fdb54 Compare July 9, 2018 18:52
@javiereguiluz
Copy link
Member

Thank you!

@javiereguiluz javiereguiluz merged commit 31c5930 into symfony:4.0 Jul 11, 2018
javiereguiluz added a commit that referenced this pull request Jul 11, 2018
This PR was merged into the 4.0 branch.

Discussion
----------

the product category must be nullable

At first I wanted to sync the return type of `getCategory()` with the changes done in #9951. Though while looking at the rest of the chapter I noticed that we indeed call `setCategory()` with `null` in a follow-up example. So I decided to allow the property to become `null` instead.

Commits
-------

31c5930 the product category must be nullable
@xabbuh xabbuh deleted the pr-9951 branch July 11, 2018 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants