I'm having issues with class table inheritance. I tried adding a class AtmosphereStudentRequest
which extends another ServiceRequest
. I'm getting the following error:
Entity 'Entities\ServiceRequest\AtmosphereStudentRequest' has to be part of the descriminator map of 'Entities\ServiceRequest' to be properly mapped in the inheritance hierachy. Alternatively you can make 'Entities\ServiceRequest\AtmosphereStudentRequest' an abstract class to avoid this exception from occuring.
The following table inheritance metadata exists in ServiceRequest
. Note I'm adding a class, alongside others that existed before and work just fine.
/**
* @Entity(repositoryClass="Repositories\ServiceRequestRepository")
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="subtype", type="string")
* @DiscriminatorMap({"service_request" = "ServiceRequest", "atmosphere_student_requests" = "\Entities\ServiceRequest\AtmosphereStudentRequest", "atmosphere_request" = "\Entities\ServiceRequest\AtmosphereRequest", ... })
* @HasLifecycleCallbacks
* @Table(name="service_requests",indexes={@index(name="service_request_status_idx",
* columns={"status"})})
*/
I dug into the code throwing the error and verified that the class ServiceRequest
didn't have AtmosphereStudentRequest
in its discriminator mapping list. I also noticed that my changes to the DiscriminatorMap annotation had no effect on the mapping list I was printing. Is caching the culprit? Do I need to run a command to update the new annotations?
I'm new to php, and web dev in php. I used the console doctrine tools to check if the mapping was correct. When I run, php doctrine orm:schema:update
. I get the following output:
...
Array
(
[0] => Entities\ServiceRequest
...
[2] => Entities\ServiceRequest\AtmosphereStudentRequest
[3] => Entities\ServiceRequest\AtmosphereRequest
...
)
...
Nothing to update - your database is already in sync with the current entity metadata.
I'm using Doctrine 1.2