diff --git a/docs/en/reference/inheritance-mapping.rst b/docs/en/reference/inheritance-mapping.rst index 9ea2edccb..ee0d4be64 100644 --- a/docs/en/reference/inheritance-mapping.rst +++ b/docs/en/reference/inheritance-mapping.rst @@ -558,3 +558,22 @@ Things to note: - The "attribute override" specifies the overrides base on the property name. - The column type *CANNOT* be changed. if the column type is not equals you got a ``MappingException`` - The override can redefine all the column except the type. + +Query the Type +-------------- + +It may happen that the entities of a special type should be queried. Because there +is no direct access to the discriminator column, Doctrine provides the +``INSTANCE OF`` construct. + +The following example shows how to use ``INSTANCE OF``. There is a three level hierarchy +with a base entity ``NaturalPerson`` which is extended by ``Staff`` which in turn +is extended by ``Technician``. + +Querying for the staffs without getting any technicians can be achieved by this DQL: + +.. code-block:: php + + createQuery("SELECT staff FROM MyProject\Model\Staff staff WHERE staff INSTANCE OF MyProject\Model\Staff"); + $staffs = $query->getResult(); \ No newline at end of file