I'm trying to implement Table Class Inheritance Doctrine 2 offers in my project Symfony 2. Let's say you have the Pizza class, the Burito class and the MacAndCheese class, which all inherit from the Food class.
The Food class has the following settings:
<?php namespace Kitchen; use Doctrine\ORM\Mapping as ORM; class Food { protected $id;
And the inherited classes have the following settings ( Pizza ):
<?php namespace Kitchen; use Doctrine\ORM\Mapping as ORM; class Pizza extends Food {
When I start doctrine: schema: update -force from the Symfony 2 application / console, I get an error message about access to the $ id access level for children Food ( Pizza for example), stating that it should be protected or weaker. I did not declare $ id anywhere in Pizza , as I thought it would be inherited from Food .
So, I tried to declare $ id, but that gives me an error because I cannot override $ id. I suppose I need some kind of link to the $ id from Food to Pizza , but the Doctrine 2 documentation didn't really give me a clear answer on how this would look.
I hope you understand what I mean and can help me.
Arno moonen
source share