-
-
Notifications
You must be signed in to change notification settings - Fork 460
Closed
Description
Hey,
Please update this bundle. I'm trying to generate new entity with this bundle, but I'm getting errors that App or AppBundle does not exist...
commands:
php bin/console doctrine:generate:entity
php bin/console doctrine:generate:entities App
My temporary fix for generating new Entities is:
Create new App class that extends Bundle in src/App.php.
Register it in the bundles.php
Unfortunately not working for php bin/console doctrine:generate:entities App
not generating getters and setters.
Bukashk0zzz, toofff, gabiudrescu, molven04, Mikilll94 and 6 moremateuszsip
Activity
fralazar commentedon Nov 3, 2017
I have the same issue when executing
doctrine:mapping:import
, since symfony4 is bundle-less there is no destination bundle to specify.stof commentedon Nov 3, 2017
Well, none of the Doctrine maintainers is in favor of using these generation commands (they tend to create more harm than good in most cases). So I suspect this is the reason why they were not spotted as broken in a Flex context yet (none of the Symfony or Doctrine maintainers trying Flex early were using them)
kironet commentedon Nov 4, 2017
Well, thats nice(I don't see what harm can generating entity cause), at this point I don't see why I should stay with Symfony, I can just switch to Laravel, if since flex it looks like I will have to do everything manually...
Ocramius commentedon Nov 4, 2017
weaverryan commentedon Nov 4, 2017
We will support the generation commands, but in a different bundle... so stay tuned :). Remember, Symfony 4 isn't even out yet - we're still (and will continue) polish things. But, thanks for the issue!
In DoctrineBundle, I think we should deprecate any commands that you don't want to support. However, I know the
doctrine:mapping:import
(though imperfect by design because it's doing an impossible task) is used by a lot of developers.gaelb80 commentedon Nov 8, 2017
The problem exists in 3.4 too when using flex.
Trying to generate getters and setters with command failed
A way to fix it in #723
andrewtch commentedon Nov 24, 2017
@stof, so you basically offer to use public properties for doctrine?
psfpro commentedon Nov 25, 2017
Hi all! DisconnectedMetadataFactory not suitable for Symfony 4 also
For example, doesn't work for PSR-4:
Ocramius commentedon Nov 25, 2017
psfpro commentedon Nov 25, 2017
Yes. I see. We can find out path from
This is the place for a little magic))
kporras07 commentedon Dec 1, 2017
Hi @weaverryan any news on this? I'm still getting the same error reported in #723 with Symfony 4
molven04 commentedon Dec 2, 2017
Hi all! I have the same issue..
My way to (hope) temporary fix it:
theedov commentedon Dec 3, 2017
@molven04, @kporras07 You can use Symfony Maker: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html
3 remaining items
andrewtch commentedon Dec 3, 2017
My 5 cents:
$blabla = new ArrayCollection
in constructorgabiudrescu commentedon Dec 3, 2017
@andrewtch I haven't been able to make PHPStorm generate methods for collections properties (addElement, removeElement + constructor initialization). hence, relied on the generator to do this instead of me.
martinezvictor84 commentedon Dec 4, 2017
to generate entities of tables in symfony 4, try it:
php bin/console doctrine:mapping:convert --from-database annotation ./src/Entity
kironet commentedon Dec 4, 2017
Yeah, I was using command
doctrine:generate:entities
only because of relationships. It was easy and fast.martinezvictor84 commentedon Dec 4, 2017
you can use a text editor plugin to generate the setters and getters
for exmaple
https://github.com/francodacosta/atom-php-getters-setters
molven04 commentedon Dec 4, 2017
Thanx @martinezvictor84
https://github.com/francodacosta/atom-php-getters-setters
https://atom.io/packages/php-getters-setters
30 remaining items
BerkhanBerkdemir commentedon Jan 24, 2018
So, will it solve? When I am using MySQL Workbench, it (
doctrine:mapping:import
) is was good for me.tvogt commentedon Jan 25, 2018
@Ocramius - public properties doesn't solve the problem for relations.
Repetitive code - well yes, we can have a discussion about getters and setters if you want, I'm not much of a fan of the concept, but I would much rather have one concept and use it consistently then mix.
Your call if you don't want to provide functionality anymore. I'm just pointing out that users rely on this functionality and value it.
Ocramius commentedon Jan 25, 2018
@BerkhanBerkdemir by moving to other libraries doing that.
@tvogt agree, every developer values quick scaffolding until it is clear that it is just generating legacy code even before the developer has touched it.
nicodemuz commentedon Jan 28, 2018
If people want to have all their choices made for them, they can move to Laravel.. lol..
bourdeau commentedon Jan 30, 2018
Hey there,
I'm adding my 2 cents opinion about this topic. Having a getters/setters generator in Doctrine is really up to @Ocramius and other Doctrine core maintainers. The thing is if this feature is depreciated and doesn't work properly, it should be removed. As Ocramius said you can use public attribute and avoid getters/setters all together, that's how we deal with it in other ORM like SQLAlchemy or in Python in general. By the way, it's been a while I didn't write any PHP/Doctrine/Symfony code, but is it normal that no error is raised when an entity has no getters/setters and all it's attributes are private? Because if I remember well it used to throw an error like "Can't access to attribute" or something like that.
alcaeus commentedon Jan 30, 2018
That must've been a long time ago. These days, Doctrine access your properties using reflection and doesn't care about accessors. If you have used Doctrine entities in combination with the Symfony Form framework, the error may have come from there as the PropertyAccess component used by the form framework indeed requires public accessors for any properties mapped in the form.
kironet commentedon Jan 30, 2018
Yeah Symfony can't stop using getter and setters, because of forms, etc...
Ocramius commentedon Jan 30, 2018
Yes it can: https://webmozart.io/blog/2015/09/09/value-objects-in-symfony-forms/
alcaeus commentedon Jan 30, 2018
Just now realized I inadvertently closed the issue this morning. After internal discussion, we decided to keep the issue closed: code generation tools have been removed from Doctrine 3.0 and are considered deprecated in the current release; this will not be updated.
If you want to keep using these features, use the MakerBundle.
Majkl578 commentedon Jan 30, 2018
Yaml mapping is being deprecated, XML and Annotations are staying.
chiqui3d commentedon Jan 30, 2018
It does not generate the setters and getters.
php bin/console doctrine:generate:entities App:Cars
error:
Can't find base path for "App\Entity\Cars" (path: "/www/crm/src/Entity", destination: "/www/crm/src/Entity").
andrewtch commentedon Jan 30, 2018
Someone, please close the comments already ) The feature is gone now.