2
我嘗試加入兩個表,但卡住寫正確的XML映射器(安裝程序和實體訪問測試,工作正常)基於MySQL的,原則2.0.4和學說2加入的問題[使用XML映射器]
- ZF-1.11
- 我正在使用XmlDriver('path \ to \ mappers);
查詢
$query = $em->createQueryBuilder()
->select('u')
->from('\Entities\Users', 'u')
->leftJoin('u.Addresses', 'a')
->getQuery();
$info = $query->getResult();
映射
<?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="Entities\Users" table="users">
<change-tracking-policy>DEFERRED_IMPLICIT</change-tracking-policy>
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name"/>
<many-to-one field="street" target-entity="Addresses" />
</entity>
</doctrine-mapping>
但與所有可能的關係(我厭倦了在這裏:)我總是得到同樣的問題:的屬性未找到相關實體:
學說\ ORM \製圖\ MappingException - 房產街道不存在