Code Monkey home page Code Monkey logo

Comments (30)

javiereguiluz avatar javiereguiluz commented on July 21, 2024 18

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.

Gregwar avatar Gregwar commented on July 21, 2024 6

I am currently using Symfony flex and not having entities available to generate accessors is really troublesome in the workflow.

from maker-bundle.

weaverryan avatar weaverryan commented on July 21, 2024 6

In working on the make:entity improvements right now. I could have a PR as early as this weekend :)

from maker-bundle.

LinkingYou avatar LinkingYou commented on July 21, 2024 5

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.

Reflex14 avatar Reflex14 commented on July 21, 2024 4

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.

zoop1984 avatar zoop1984 commented on July 21, 2024 4

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.

weaverryan avatar weaverryan commented on July 21, 2024 3

Haha, perfect! Because it will need some testing ;).

from maker-bundle.

fredpo avatar fredpo commented on July 21, 2024 3

@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.

weaverryan avatar weaverryan commented on July 21, 2024 2

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.

fredpo avatar fredpo commented on July 21, 2024 2

@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.

stof avatar stof commented on July 21, 2024 1

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.

gabiudrescu avatar gabiudrescu commented on July 21, 2024 1

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.

gabiudrescu avatar gabiudrescu commented on July 21, 2024 1

have you tried this command to generate a Category tree?

basically, a one to many self referencing.

from maker-bundle.

gabiudrescu avatar gabiudrescu commented on July 21, 2024

@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.

javiereguiluz avatar javiereguiluz commented on July 21, 2024

I don't know what to say about your second question. We'll need to think about it.

from maker-bundle.

pascalwacker avatar pascalwacker commented on July 21, 2024

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.

gabiudrescu avatar gabiudrescu commented on July 21, 2024

@weaverryan that's awesome news! Santa is coming early this year :D

from maker-bundle.

gabiudrescu avatar gabiudrescu commented on July 21, 2024

Can't hardly wait to beta test this

from maker-bundle.

nkl90 avatar nkl90 commented on July 21, 2024

I do not understand one thing, why not modernized SensioGeneratorBundle for SF4 Flex? Why this bicycle?

from maker-bundle.

javiereguiluz avatar javiereguiluz commented on July 21, 2024

@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.

nkl90 avatar nkl90 commented on July 21, 2024

@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.

weaverryan avatar weaverryan commented on July 21, 2024

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.

fredpo avatar fredpo commented on July 21, 2024

@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.

weaverryan avatar weaverryan commented on July 21, 2024

@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.

fredpo avatar fredpo commented on July 21, 2024

@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.

nkl90 avatar nkl90 commented on July 21, 2024

@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.

safwan74 avatar safwan74 commented on July 21, 2024

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.

safwan74 avatar safwan74 commented on July 21, 2024

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.

weaverryan avatar weaverryan commented on July 21, 2024

See #104 :). An even better version of the command is coming.

from maker-bundle.

IndraGunawan avatar IndraGunawan commented on July 21, 2024

i guess we can close this issue because v1.3.0 has been released

from maker-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.