-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
Deprecating doctrine:generate:entities and pointing to MakerBundle #790
Conversation
@@ -72,6 +72,9 @@ class is supposed to extend which. You have to adjust the entity | |||
*/ | |||
protected function execute(InputInterface $input, OutputInterface $output) | |||
{ | |||
trigger_error('The doctrine:generate:entity command has been deprecated.', E_USER_DEPRECATED); | |||
$output->writeln(' <comment>NOTE:</comment> The <info>doctrine:generate:entities</info> command has been deprecated. Use <info>make:entity --regenerate</info> from MakerBundle instead.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd likely suggest pointing out the bad practice and point it at the docs instead. We (doctrine project) do not endorse MakerBundle in any way, as it just perpetuates an already too widespread misuse of mappings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest changing the language to something like this:
$output->writeln(' <comment>NOTE:</comment> The <info>doctrine:generate:entities</info> command has been deprecated. To read more about the differences between anemic and rich models go here <link to our docs>. If you wish to generate your entities, use <info>make:entity --regenerate</info> from MakerBundle instead.');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @Ocramius, suggesting bad practice is bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, wrong button
I like the idea of deprecating this command. How about writing a message like:
(obviously we need to update that page to say WHY this is a bad practice) |
I like @Nyholm's idea. DoctrineBundle is the intersection of Symfony & Doctrine. This would allow us to give your recommendation on the matter, but also point people to the Symfony resource that is available, should they choose it. |
There is currently no recommendation regarding this and Symfony explicitly rejected to do so. So at current state it's a no from me. |
Thank you for your input. I have not seen these PRs before. So if I understand you correctly you are fine with this PR if there is a section in the docs that explains why this command was deprecated. The symfony docs will also say something like: "If you still really want this generate feature, then look at the MakerBundle". |
Great idea if the docs are coming from this repo, but since we disagree on practices (as @Majkl578 pointed out): no. Link http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html#adding-behavior-to-entities instead. |
Hi guys! I've just updated the message to talk about anemic models and link to the new section on the Doctrine documentation. THEN, at the end, I mention the new command if the user still wants it. It looks like this: If you guys want to educate on anemic versus rich models, this is much better than just having a command that doesn't work :). |
+1 from here. Will merge if no objections. Is there any symfony documentation about using dto's + doctrine with forms vs letting using form + doctrine? If not i believe it could be a nice addition. |
Not really. And we talked internally, and I think this is something we need to improve - both showing forms with model objects (or at least mentioning that more specifically) and also showing data mappers, which already has a PR (symfony/symfony-docs#6900) we just need to "un-stuck" it :). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is on an acceptable middle-ground now 👍
@weaverryan Thanks |
Thanks @weaverryan and @Ocramius! |
Since the Doctrine devs aren't interested in maintaining the generation commands and since we implemented them in MakerBundle, I hope this will be a nice win for everyone: let's point them elsewhere and avoid issues being created related to Symfony 4 support :).