Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different table name and entity name in Symfony2

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?

like image 628
Cristhian Boujon Avatar asked Jul 30 '15 02:07

Cristhian Boujon


1 Answers

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.

like image 177
Vamsi Krishna B Avatar answered Sep 28 '22 02:09

Vamsi Krishna B