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

Stable Version 4 Release for Symfony Maker #474

Closed
weaverryan opened this issue Feb 8, 2018 · 4 comments
Closed

Stable Version 4 Release for Symfony Maker #474

weaverryan opened this issue Feb 8, 2018 · 4 comments

Comments

@weaverryan
Copy link
Contributor

Hi guys!

First, I don't intend to be pestering :) - I've watched the progress on version 4 of this library with great excitement! We're already using it - specifically the new "preserve formatting print mode" - quite extensively in the Symfony world for our code generation bundle: symfony/maker-bundle#104.

It's working brilliantly... so brilliantly that the PR is now stuck, waiting for the version 4 stable release.

Do you guys have a specific amount of time in mind between the beta & stable? Does having a library using the new feature help validate? Can I help do anything else (bring coffee, etc).

Cheers!

@nikic
Copy link
Owner

nikic commented Feb 8, 2018

I think we're pretty close to a stable 4.0 release. I don't have any more code changes planned, but want to touch up the documentation a bit more.

@weaverryan
Copy link
Contributor Author

Thanks @nikic! I'm looking forward to it. I noticed the docs reorg lately - it feels a bit "flatter" to me now (in a good way) - easy to see everything from the docs homepage :)

@nikic
Copy link
Owner

nikic commented Feb 28, 2018

Aaaand here we go: https://github.com/nikic/PHP-Parser/releases/tag/v4.0.0

@nikic nikic closed this as completed Feb 28, 2018
@weaverryan
Copy link
Contributor Author

Wooohoooo! I owe you for having this great new feature, right when we needed it <3

weaverryan added a commit to symfony/maker-bundle that referenced this issue Mar 17, 2018
… update support (weaverryan)

This PR was squashed before being merged into the 1.0-dev branch (closes #104).

Discussion
----------

make:entity improved: interactive field created & entity update support

Hi guys!

The PR we (or at least me) have been waiting for :). This makes `make:entity` behave similar to `doctrine:generate:entity` from SensioGeneratorBundle: it interactively asks you for the field names and generates the getters/setters... but with some improved UX.

## Features:

* Ability to create new entities & fields
* Ability to update *existing* entities 🎆
* Support for adding *relations* (double 🎆)
* A `--regenerate` flag to add getters/setters for existing properties (replaces `doctrine:generate:entities`)
* Generates code that passes phpcs

Please help test! It's easy: [composer require details to for testing](https://gist.github.com/weaverryan/a20fc281ccd1faea2ea04a5da7fdaa55)

## Blocker 😢

We're using the newest version of `nikic/php-parser` heavily... but it only has a *beta* release so far :(. We need to wait until this is stable. OR, we need to remove it as a dependency temporarily, then throw an error to tell people to install it manually (at the beta version). :/ nikic/PHP-Parser#474

## Important notes:

* I bumped the min php version to 7.1 (from 7.0). This was so that we could consistently generated code using nullable types.

* Some of the code generated for relationships is opinionated. For example, I automatically synchronize (i.e. by calling the setter) the *owning* side if you set data on the inverse side of the relation. I also make all relation return types nullable (even if the relation is required in the db), to be friendly in case they're not set yet.

* The setters are not fluent. We *could* make them fluent, or make that an option on the bundle (i.e. one in a config file, not asked interactively)

![make:entity](https://i.imgur.com/Sflti0y.gif)

If you want to see the available type list (relations are now in this list, but not shown):

<img width="535" alt="screen shot 2018-01-08 at 3 09 32 pm" src="https://user-images.githubusercontent.com/121003/34690183-21f7498e-f486-11e7-9fcf-a5fe56d2a321.png">

I would love feedback! I added many little "features" to make the user experience as excellent as possible. But, I need users to help validate that!

Cheers!

Commits
-------

16596b1 updating tests for removed comment
01f6a3c Fixing a bug where a repository would not be generated under certain conditions
2f0e0f3 adding support for associative arrays in annotations
7d3042c Fixing bug where the name was always interactive
2a72ee3 Fixing cs
3b65fb6 Merge branch 'master' into make-entity-improved
e54988c Fixing issue where sometimes nullable is not defined on a join column
259141d removing comment - it does not add much value & is hard to keep in the right place
b0fed52 updating to stable nickic/php-parser 4.0 release!
7bcc966 Disabling replaceNodes to avoid possible AST accidental changes
613abef Adding an option (true by default) for fluent setter methods
8634a91 cs
9261cd1 Adding the "length" question for the string type
9c5a786 phpcs
328e486 fixing windows bug
92aeff5 playing with appveyor
b3647d7 attempting to split tests to combat windows testing issue
f022f5f Fixed window path bug while looking for the vendor/ dir
89d5708 trying to fix windows tests with long paths that cause errors :/
fd088ac temporarily debugging Windows errors
35ef3ae removing duplicate sqlite extension for appveyor
8c37893 Making appveyor use sqlite for simplicity
abbe8d9 Fixing windows bug where C:/ slash may already be normalized
20df636 Fixing a few Windows bugs
f9fa0db adding missing success message
38e6a0e Fixing missing return on --regenerate
1650301 Fixing missing method
fb74302 Fixing typo for class name
9c40654 added missing service
866e534 Extracting logic into AutoloaderUtil
05480da Fixing bug where new classes were never actually written in regenerator
e535f0d Adding an error if you try to generate a class that does not use annotation metadata
656c199 Fixing 2 merge bugs: entities could not be updated & mix up of entity vs repo class name
8d400e7 Fixing bug with getting property of classes just created
e8e5689 fix arg name
b8856c0 Code changes to sync with upstream updates
4afbc0e removing dup functions after merge
a34a1a2 Fixing "composer require orm orm" bug
5bc34bd removing unused use
d34ff45 also run phpcs on updated files
f370b52 fixing tests
5395788 Not setting the owning side (from inverse) on OneToOne
922563a clarifying note
ab03675 fixing missing return type
cf9e08a making decimal/scale more clear
0f2d52d Removing unnecessary service locator: just let the registry be null
1f57317 minor tweaks
d65d772 Fixing some tests
a822400 adding missing headers
dc7973d Fixing tests + one missing return
c3ccf5f Ask the user if they want the inverse side of a relation
2fd2e0c Making the user message a little nicer
663afee test needs database
c79b73c Fixes thanks to Stof!
6c914fa Removing debugging code, committing missing file to fix tests
4bde1dc With --overwrite, put updated methods in same location as original
ed15a2b temp debugging code for failing test on CI
dbe11a5 hack to fix tests temporarily
cd4f517 Fixing possible non-existent directory in tests
e52e33e Adding an enhanced make:entity command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants