Skip to content
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

Docs: Moving *attributes* mapping to first position #10364

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

ThomasLandauer
Copy link
Contributor

@ThomasLandauer ThomasLandauer commented Jan 3, 2023

Question: There are various occurrences of #[Column(type: 'integer')] on this page. I'd like to replace them with either:

  1. #[Column()] since in recent versions the type is derived from the PHP typehint anyway
  2. #[Column(type: Types::INTEGER)]
    Which one is better?

@derrabus
Copy link
Member

derrabus commented Jan 3, 2023

Which one is better?

Option 3: #[Column] 🤓

@derrabus
Copy link
Member

derrabus commented Jan 3, 2023

Is this the only place where would need to swap annotations and attributes?

Note to my future self: This is going to be hell to merge up. 🙈

@ThomasLandauer
Copy link
Contributor Author

Is this the only place where would need to swap annotations and attributes?

AFAIK, the agreed best-practice is to always show attributes first: #9555 (comment)
But it looks like there was no systematic approach to change them all. So whenever I stumble over one, I fix it ;-) So I don't know how many old versions are still out there...

@derrabus
Copy link
Member

derrabus commented Jan 3, 2023

AFAIK, the agreed best-practice is to always show attributes first: #9555 (comment)

Absolutely.

But it looks like there was no systematic approach to change them all. So whenever I stumble over one, I fix it ;-) So I don't know how many old versions are still out there...

The reason for my asking is that I'd rather merge one big painful PR that fixes this inconsistency once and for all that to merge hundreds of micro-PRs for the same problem. 😓

@derrabus derrabus added this to the 2.14.1 milestone Jan 3, 2023
@derrabus derrabus merged commit 0852847 into doctrine:2.14.x Jan 3, 2023
@ThomasLandauer ThomasLandauer deleted the patch-9 branch January 3, 2023 21:59
ThomasLandauer added a commit to ThomasLandauer/orm that referenced this pull request Jan 3, 2023
Yet another micro-PR ;-) - as requested at doctrine#10364 (comment)

I also changed `$currentPrice` from `float` to `int`, since IMO it's better to store prices as `int` (=cents).

Question: Is there a reason why most typehints are `int|null`, instead of `?int`? Should I change them?
SenseException pushed a commit that referenced this pull request Jan 3, 2023
Yet another micro-PR ;-) - as requested at #10364 (comment)

I also changed `$currentPrice` from `float` to `int`, since IMO it's better to store prices as `int` (=cents).

Question: Is there a reason why most typehints are `int|null`, instead of `?int`? Should I change them?
derrabus added a commit to derrabus/orm that referenced this pull request Jan 9, 2023
* 2.14.x:
  PHPStan 1.9.8, Psalm 5.4.0 (doctrine#10382)
  fix typo for missing a comma (doctrine#10377)
  Docs: Removing `type: 'integer'` from mappings (doctrine#10368)
  Docs: Moving *attributes* mapping to first position (doctrine#10364)
  Docs: Deleting duplicate mapping example (doctrine#10363)
derrabus added a commit to derrabus/orm that referenced this pull request Jan 9, 2023
* 2.15.x:
  Use more precise types for class strings (doctrine#10381)
  PHPStan 1.9.8, Psalm 5.4.0 (doctrine#10382)
  fix typo for missing a comma (doctrine#10377)
  Docs: Removing `type: 'integer'` from mappings (doctrine#10368)
  Docs: Moving *attributes* mapping to first position (doctrine#10364)
  Docs: Deleting duplicate mapping example (doctrine#10363)
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.

2 participants