Reputation: 4190
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?
Upvotes: 16
Views: 15506
Reputation: 607
This is still the first result on my web search here is an updated answer for modern Symfony:
#[ORM\Table(name: 'groups')]
class Group
{
Upvotes: 0
Reputation: 11490
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.
Upvotes: 40
Reputation: 570
You could set name param for mapping http://symfony.com/doc/current/book/doctrine.html#add-mapping-information
Upvotes: -1