For those interested in the answer:
I based my answer on this: How to set up an object (doctrine) to represent a database in Symfony 2
For example, if you have a view "A" with a column of "Id" and "Name":
In src / Name / YourBundle / Resources / config / doctrine, create "A.orm.yml" with attributes like:
Name\YourBundle\Entity\A: type: entity table: A fields: id: id: true type: integer unsigned: false nullable: false column: id generator: strategy: IDENTITY name: type: string length: 35 fixed: false nullable: true column: name
After that, create your A.php file in the Name / YourBundle / Entity / A field:
namespace Name\YourBundle\Entity; use Doctrine\ORM\Mapping as ORM; class A { private $id; private $name; public function getId() { return $this->id; } public function getName() { return $this->name; } }
And ... you can call your opinion using your controller.
source share