0
votes

I'm working on a project where entities mapping is trough XML. So this is how my entity is:

<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                    http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity name="Device\DeviceBundle\Entity\Device" table="device">
        <id name="id" type="integer" column="id">
            <generator strategy="AUTO" />
        </id>
        <field name="description" column="description" type="string" length="255" unique="true" nullable="false" />
        <field name="imei" column="imei" type="string" length="17" unique="true" nullable="false" />
        <field name="created" type="datetime">
            <gedmo:timestampable on="create"/>
        </field>
        <field name="modified" type="datetime">
            <gedmo:timestampable on="update"/>
        </field>
        <field name="deletedAt" type="datetime" nullable="true" />
        <gedmo:soft-deleteable field-name="deletedAt" time-aware="false" />
    </entity>
</doctrine-mapping>

When I run the command doctrine:schema:validate from Symfony2 console I get this as output:

[Doctrine\Common\Persistence\Mapping\MappingException]
Class 'TaxiBooking\Device\DeviceBundle\Entity\Device' does not exist

And yes, that's right the file doesn't exists but should I create this file or I miss something in the XML mapping? Any help?

I read this and this but that doesn't clear my doubt at all

1

1 Answers

0
votes

Well I'll answer myself since none does. The answer is "YES" the file needs to be created since XML mapping just does the same as Annotation mapping, in order to describe fields, columns, relations definitions and so on.