When I generate my entities I have a file prefixed with ~
like a backup file or something
Is it a bug or you need to manually remove them?
In the Doctrine terminology, a Data Mapper is called an Entity Manager. Entities are plain old PHP objects of the domain layer. Thanks to the Entity Manager, they don't have to be aware that they will be stored in a database.
The EntityManager is the central access point to ORM functionality. It can be used to find, persist, flush and remove entities.
Doctrine uses the Identity Map pattern to track objects. Whenever you fetch an object from the database, Doctrine will keep a reference to this object inside its UnitOfWork. The array holding all the entity references is two-levels deep and has the keys root entity name and id.
Well, entity is a type of object that is used to hold data. Each instance of entity holds exactly one row of targeted database table. As for the directories, Symfony2 has some expectations where to find classes - that goes for entities as well.
From the official documentation in Symfony2 CLI command:
$> php app/console help doctrine:generate:entities
....
By default, the unmodified version of each entity is backed up and saved (e.g. Product.php~). To prevent this task from creating the backup file, pass the --no-backup option:
php app/console doctrine:generate:entities Blog/Entity --no-backup
So to summarize, you may add --no-backup
option to your command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With