Not a fix by any means but a workaround till they catch up. Very much a cowboy method.
- Setup a new project with the standard Symfony file structure.
- Copy your basic objects into the entity folder.
- Generate the entitles there
php bin/console doctrine:generate:entities AppBundle
- Copy and paste them into your new Symfony Flex project entity folder.
- Using an IDE do a find and replace in the folder for AppBundle with App
Sorry, it's far from ideal, but the easiest method I've found rather than having to generate all the getter/setters by hand.
UPDATE: 25/01/2017
As of 4.x the whole idea of doctrine:generate:entities
has been dropped (In this issue after a long read you'll notice that Doctrine has dropped the commands completely, hence the new Symfony maker bundle).
Apparently, it's viewed as bad practice. Instead, they've released a new package called maker, which essentially creates the entity class for you but without the getters/setters, and the new suggested practice is to rely on your IDE to auto-generate the Getters and Setters for you.
This works except for the constructor for ArrayCollections
for @OneToMany
, but it doesn't take much to add these by hand.
What I've said above is also reflected in the Symfony documentation.
Generating Getters and Setters
Doctrine now knows how to persist a Product object to the database.
But the class itself isn't useful yet. All of the properties are
private, so there's no way to set data on them!
For that reason, you should create public getters and setters for all
the fields you need to modify from outside of the class. If you use an
IDE like PhpStorm, it can generate these for you. In PhpStorm, put
your cursor anywhere in the class, then go to the Code -> Generate
menu and select "Getters and Setters":