I would like to use Class Table Inheritance
:
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"player" = "Player", "admin" = "Admin"})
*/
class User
{
// ...
}
/** @Entity */
class Player extends User
{
// ...
}
/** @Entity */
class Admin extends User
{
// ...
}
My question is:
If I have a Collection of User
s, how is it possible to check, which one is an Admin
and which one is a Player
. And how to call a method of the subclass after that?