It seems your Driver class is in a namespace that starts with "TaxiBooking"?

Cheers
On Jul 1, 2014 4:26 PM, "[email protected]" <[email protected]> wrote:

> Hi every,
> I'm mapping a n:m relationship and I do it as follow:
>
> `Device\DeviceBundle\Entity\DriverHasDevice.php`
>
>     namespace Device\DeviceBundle\Entity;
>
>     use Driver\DriverBundle\Entity\Driver;
>     use Device\DeviceBundle\Entity\Device;
>
>     class DriverHasDevice
>     {
>
>         protected $driver;
>         protected $device;
>
>         public function setDriver(Driver $driver)
>         {
>             $this->driver = $driver;
>         }
>
>         public function getDriver()
>         {
>             return $this->driver;
>         }
>
>         public function setDevice(Device $device)
>         {
>             $this->device = $device;
>         }
>
>         public function getDevice()
>         {
>             return $this->device;
>         }
>
>     }
>
> `Device\DeviceBundle\Resources\config\doctrine\DriverHasDevice.orm.xml`
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <doctrine-mapping xmlns="
> http://doctrine-project.org/schemas/orm/doctrine-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\DriverHasDevice"
> table="driver_has_device">
>             <id name="driver" association-key="true" />
>             <id name="device" association-key="true" />
>
>             <many-to-one field="driver"
> target-entity="Driver\DriverBundle\Entity\Driver" />
>             <many-to-one field="device"
> target-entity="Device\DeviceBundle\Entity\Device" />
>         </entity>
>     </doctrine-mapping>
>
>
> `Driver\DriverBundle\Entity\Driver.php`
>
>     namespace TaxiBooking\Driver\DriverBundle\Entity;
>
>
>     class Driver
>     {
>         protected $id;
>         protected $name;
>         protected $status;
>
>         public function getId()
>         {
>             return $this->id;
>         }
>
>         public function getName()
>         {
>             return $this->firstname;
>         }
>
>         public function setName($name)
>         {
>             $this->name = $name;
>         }
>
>         public function getStatus()
>         {
>             return $this->status;
>         }
>
>         public function setStatus($status)
>         {
>             $this->status = $status;
>         }
>     }
>
> `Driver\DriverBundle\Resources\config\doctrine\Driver.orm.xml`
>
>     <?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="Driver\DriverBundle\Entity\Driver" table="driver"
>                 repository-class="Driver\DriverBundle\Entity\Driver">
>             <id name="id" type="integer" column="id">
>                 <generator strategy="AUTO"/>
>             </id>
>             <field name="name" type="string" column="name" length="50"
> precision="0" scale="0" nullable="true"/>
>             <field name="status" type="integer" column="status" length="1"
> precision="0" scale="0" nullable="true"/>
>             <gedmo:soft-deleteable field-name="deletedAt"
> time-aware="false"/>
>         </entity>
>     </doctrine-mapping>
>
> Now I'm trying to validate the schema running the command `Symfony >
> doctrine:schema:validate` from Symfony2 shell and I get this error:
>
> [Doctrine\ORM\Mapping\MappingException]
>   The target-entity Driver\DriverBundle\Entity\Driver cannot be found in
> 'Device\DeviceBundle\Entity\DriverHasDevice#driver'.
>
> Where is the problem in my mapping? I can't see it
> Regards in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to