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

[DX] Adding bool and integer types and annotations #1073

Merged
merged 1 commit into from
Apr 4, 2015

Conversation

malarzm
Copy link
Member

@malarzm malarzm commented Apr 3, 2015

I keep using @ODM\Bool annotation and later swearing it doesn't exist and changing to full @ODM\Boolean. Here are some pros of adding this:

  1. We have int type, not integer
  2. Scalar Type Hints are in favor of bool
  3. bool is common in all languages

The only downside of this I see is that if somebody would have already done that on his own via Type::addType he will get exception now.

@malarzm malarzm added the Idea label Apr 3, 2015
@gerryvdm
Copy link

gerryvdm commented Apr 3, 2015

Shouldn't we, by the same reasoning, also add an "Integer" type? :)

@malarzm
Copy link
Member Author

malarzm commented Apr 3, 2015

@gerryvdm If we end up merging this I'm totally fine with having @ODM\Integer especially if it will save somebody a swear, DX is good thing ;)

@alcaeus
Copy link
Member

alcaeus commented Apr 3, 2015

👍 for bool
👍 for integer
👍 for adding the same DX to the XML and YAML mapping

@lavoiesl
Copy link
Member

lavoiesl commented Apr 3, 2015

👍, and Integer should exist too.

@jmikola
Copy link
Member

jmikola commented Apr 3, 2015

I assume the "alias" classes, which are really for annotations, will just extend the existing one. Is that correct?

I've no objections to creating both "Bool" and "Integer". Is this DX suggestion relevant to ORM?

@malarzm
Copy link
Member Author

malarzm commented Apr 3, 2015

@jmikola can't really extend existing one since it's final and I didn't want to change that. Also by registering normal type it should work for YAML/XML mappings out of the box

Haven't used ORM in quite a while but IIRC they had something like @ORM\Column(type="boolean") so I can submit similar thing there later

@smolinari
Copy link

I have to ask a totally noob question, but what does DX mean?

Scott

@malarzm
Copy link
Member Author

malarzm commented Apr 3, 2015

@smolinari Developer eXperience :)

@lavoiesl
Copy link
Member

lavoiesl commented Apr 3, 2015

@malarzm Could you update your PR to support Integer as well?

@malarzm
Copy link
Member Author

malarzm commented Apr 3, 2015

@lavoiesl I'll do that later today or tomorrow, don't worry ;)

@smolinari
Copy link

@malarzm Oh, duh! Thanks for reminding me. I actually just read a few weeks ago the blog about the push Symfony is making on DX. I should have guessed that. I just couldn't put it together in context to the discussion here. Enough excuses. I am simply a noob. LOL!

Scott

@malarzm malarzm changed the title Adding bool type [DX] Adding bool and integer types and annotations Apr 4, 2015
@malarzm
Copy link
Member Author

malarzm commented Apr 4, 2015

Integer type and annotation are added

malarzm added a commit that referenced this pull request Apr 4, 2015
[DX] Adding bool and integer types and annotations
@malarzm malarzm merged commit 49e30f8 into doctrine:master Apr 4, 2015
@malarzm malarzm added this to the 1.0.0-BETA13 milestone Apr 4, 2015
@jmikola
Copy link
Member

jmikola commented Apr 9, 2015

@jwage: Spoke in IRC about this. DBAL has "boolean" and "integer" mappings, while we only had "boolean" and "int". @malarzm raises a point that this would break anyone with custom "integer" or "bool" types defined, but I don't think that's likely to affect very many users (why would you have a custom "bool" type that differs significantly from the stock "boolean" type?).

I'm 👍 on this, but I also accept that ORM does not want the aliases due to BC concerns. On the plus side, this PR will make our "int" type consistent with ORM's "integer" type name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants