Comments (30)
I agree completely. Creating an interactive make:entity
was on our TODO list since day one. For the first version of the bundle we didn't want to include interactive commands, but we're working on this.
from maker-bundle.
I am currently using Symfony flex and not having entities
available to generate accessors is really troublesome in the workflow.
from maker-bundle.
In working on the make:entity improvements right now. I could have a PR as early as this weekend :)
from maker-bundle.
The official symfony documentation (3.4 / 4.0) describes that you can use other formats instead of annotations ( https://symfony.com/doc/current/doctrine.html ).
It also works as described - Symfony gets the needed database / table info from the configured YML file.
But it does not make sense if I should write the YML files in the future and then create the appropriate entity class by hand.
I would also be very happy if the new Maker Bundle can also create and update the appropriate Entity classes from Yml files. I also love annotations elsewhere - but with entities, working with yml files is much faster and easier.
from maker-bundle.
I was searching for this, because I could not believe it was gone. Happy to see there is an issue, confirming this.
We are on the start of a new project and putting ideas directly into your project, this fast, is the most fun part of any project. And I don't care if I made a typo in the process, most of the time I'll continue and fix it later on.
Right now I'm stubborn and will continue using SF4 but I have a SF3.3 project alongside to generate my orm and entities š¤£
from maker-bundle.
Glad to see that it isn't just me. I've been searching for it everywhere. Might want to take a look at the docs page at https://symfony.com/doc/current/doctrine.html
It first talks about how to generate an entity, then about how to expand fields (including xml/yml examples) and then "The Product class is fully-configured and ready to save to a product table.", thats plainly not true, the steps above it don't update the product class at all and thus the migrations stuff afterwards fails. The example only works if you use annotations, since you'll be defining the field variables at the same time (and afterwards, no other xml/yml examples are given anymore, its all about those horrible annotations).
The main selling point for Symfony always was for us how it can take work away from you, not having to worry to perfectly create object classes, just define your fields and Symfony does the rest. Never believed in annotations but luckily there were always alternate options. But now, we need to do everything manually. Work that previously took seconds, now takes minutes. Time to switch back to Symfony 3.x, in our opinion, Symfony 4 simply isn't production ready yet.
from maker-bundle.
Haha, perfect! Because it will need some testing ;).
from maker-bundle.
@nkl90 If you check doctrine/DoctrineBundle#729, you will find that Doctrine no longer supports generation. Even though it's a very popular feature the maintainers decide that they will no longer generate entities, getters and setters because it makes it too easy for people to develop and creates "anemic entities," as if no one edits them afterwards.
I found the whole thread very childish and the Doctrine maintainers to be very arrogant and narrow minded. So I guess we have to have a Symfony solution and not rely on Doctrine.
At the moment I'm forced to generate in Symfony 3.3 and copy over to Symfony 4. It's really annoying, especially when using API Platform, which relies on generation for a streamlined process.
Honestly, who wants to sit there and grind through creating entities, getters and setters. Design DB, generate, customize, done.
from maker-bundle.
The trick will be to try to not create too many questions. The old command suffered from usability problems: people would make a typo 10 questions in and not be able to recover. Thatās the challenge.
I would also like to support relations ships. And I would like to generate getters + setters: thatās especially useful because we can generate really awesome add/remover methods for relationships that synchronize the inverse side.
from maker-bundle.
@gabiudrescu
I use the same chain for prototyping and bootstrapping a project. This whole Flex move is completely pointless without an efficient way to generate Entities, which is time consuming and is a stumbling block when you just want an API up and running quickly.
I'm glad to see this issue getting attention.
from maker-bundle.
The other thing to remember is that the SensioGeneratorBundle command was relying on the Doctrine ORM EntityGenerator, which is not actively maintained and is actively recommended against using it by the Doctrine ORM team.
from maker-bundle.
What about __toString() methods?
what do you think about adding a question to ask the developer if there should be a __toString() method in that entity?
ideally, the developer should be able to specify a string field that can be used for retrieval on this magic method call.
from maker-bundle.
have you tried this command to generate a Category tree?
basically, a one to many self referencing.
from maker-bundle.
@javiereguiluz that's an awesome news! I find those interactive commands very helpful and allow me to be very productive. hope I'm not the only one using / asking for them :)
how about the other idea: taking the responsibility of doctrine:generate:entities
from DoctrineBundle to MakerBundle for generating entities based on existing mapping (yml, xml or even annotations)?
from maker-bundle.
I don't know what to say about your second question. We'll need to think about it.
from maker-bundle.
Is there an ETA on an improved make:entity
command? And will there be a replacement to generate getter/setter? Sure IDE like PHPStrom can do it too, but I'd still prefer a console command for it.
from maker-bundle.
@weaverryan that's awesome news! Santa is coming early this year :D
from maker-bundle.
Can't hardly wait to beta test this
from maker-bundle.
I do not understand one thing, why not modernized SensioGeneratorBundle for SF4 Flex? Why this bicycle?
from maker-bundle.
@nkl90 we thought about that ... but the effort to modernize/refactor GeneratorBundle would be bigger than creating MakerBundle from scratch and the result would be worse.
from maker-bundle.
@fredpo, I've been doing this all my life: Design DB, generate, customize, done. But Doctinre has taught me not to think about the DBMS in the development process. And now I have to retrain. This is bullshit!
from maker-bundle.
If you want to test the new command, see #104. It does everything the old commands did, and more :).
The doctrine:generate:entities equivalent is āmake:entity --regenerateā
from maker-bundle.
@weaverryan That's awesome and works great for small projects. Now if only it generated all that from a database. Going through an interactive generator for 200+ fields with 40+ relations is not an efficient use of time.
from maker-bundle.
@fredpo - that part is a separate issue. We do still need to update DoctrineBundle so the reverse engineering stuff works without a bundle. I donāt think the doctrine devs are against that, and I think it should be fairly simple - I havenāt looked at it yet. Once youāve reverse engineered to, for example, XML, you can use the make:entity command to generate all your classes.
For your project, just create a bundle temporarily so you can do the reverse engineer step.
from maker-bundle.
@weaverryan Great to hear that you're on it š
just create a bundle temporarily so you can do the reverse engineer step
That's the current process, unfortunately.
from maker-bundle.
@fredpo, not always data stored in single source. Sometimes it happens data stored in many source (REST API, SOAP, SQL, NoSQL and etc.). For such case this soulitions (fast prototyping data models via console command) it was coined.
from maker-bundle.
When I type php bin/console make:entity, I don't get the interactive tool with it. It just creates the class without giving me the chance to enter the properties "Fields"
from maker-bundle.
Gabiudrescu, it is exactly what I was working on, a Category, one to many self referencing. luckily the doctrine documentation is straight forward and exact match for my requirements. However, I really miss the standard edition in my latest project. It was so easy to generate the skeleton of the entity, and then I carry on working on the associations manually. It is a lot of pain if you have an entity with many properties and you have to type them manually or copy and paste and imagine if you have so many entities. I guess as a community we will have to solve this lack of generator tools in flex. I like flex a lot and it is a step in the right direction but the awesomeness of Symfony comes from these tools. I understand that flex is optional in 3.4 and even in 4. I like the structure and the bundle-less approach, it will be even greater with the maker bundle if all the generation tools are maturing enough.
from maker-bundle.
See #104 :). An even better version of the command is coming.
from maker-bundle.
i guess we can close this issue because v1.3.0 has been released
from maker-bundle.
Related Issues (20)
- [make:entity] addGetter on boolean field that starts with "is" HOT 1
- [make:entity] `generate()` call to `is_string()` appears to always evaluate to `false`
- Missing ? in symfony console make:entity? HOT 9
- Critical error: ClassSourceManipulator HOT 4
- [make:entity] Exception in DoctrineHelper.php HOT 2
- Why is the registration confirmation link (verify-email-bundle) not working in Symfony 6 ? HOT 8
- [make:auth] V1.59 - Deprecated classes causes deprecated message on each page HOT 1
- [make:entity] no more autocompletion on repository methods HOT 1
- Use final classes
- Deprecation : symfony/maker-bundle v1.59.0 HOT 1
- PHPStan - User::getPassword()
- PHPStan - ResetPasswordRequest::getUser()
- [make:crud] Add support for dynamic CSRF id with Expression in `#[IsCsrfTokenValid]`
- [make:crud] Allow `EntityValueResolver` to return a list of entities
- [make:registration-form] Add `hash_property_path` option to `PasswordType` HOT 1
- [make:reset-password] Add `hash_property_path` option to `PasswordType` HOT 1
- [make:entity] Entity Names Should Be Allowed to Have Digits (i.e. v1) HOT 1
- [make:entity] default value
- [make:entity] Maker modifies vendor files if FQCN covers up local alias HOT 2
- Feature Request: Allow custom Generator class in MakerInterface
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maker-bundle.