I have an existing database. Lets say that I have a table named "transactions" and I want to create the corresponding Entity named "Transaction". How can I do that?
Asked
Active
Viewed 1.4k times
15
Bond
- 16,071
- 6
- 30
- 53
Cristhian Boujon
- 4,060
- 13
- 51
- 90
2 Answers
39
you can set the name of the table using the @ORM\Table annotation
/**
* @ORM\Entity
* @ORM\Table(name="transactions")
*/
class Transaction
{
If you don't use Annotations, you can find details about other mappings from this link.
BTW, You can also generate Entities from an Existing Database.
Vamsi Krishna B
- 11,377
- 15
- 68
- 94
-1
You could set name param for mapping http://symfony.com/doc/current/book/doctrine.html#add-mapping-information
Tuan nguyen
- 560
- 6
- 19
-
This link just goes to a large documentation page. Was there something specific you were trying to answer with? – James Jan 11 '22 at 14:45