私は Doctrine 2 を初めて使用するので、docs.doctrine-project.orgのドキュメントをテンプレートとして使用しています。必要なすべてのファイルを生成しました(と思います)。今、コマンドを実行しようとしています
doctrine orm:schema-tool:create
しかし、教義は吐き出しています
[Doctrine\ORM\Mapping\MappingException]
Invalid mapping file 'QueryRequest.dcm.xml' for class 'QueryRequest'.
これが私のQueryRequest.dcm.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://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
<entity name="RequestMetadata" table="request_metadata">
<id name="id" type="bigint">
<generator strategy="AUTO" />
</id>
<field name="snapshot" column="snapshot" type="smallint" nullable="true" />
<field name="custID" column="cust_id" type="string" length="8" />
<field name="ipAddress" column="ip_addr" type="string" length="15" />
<field name="query" column="query" type="string" length="500" />
<field name="createdOn" column="created_on" type="datetime" />
<one-to-many field="httpRequestResponses" target-entity="HttpRequestResponse" mapped-by="queryRequest">
<cascade>
<cascade-persist />
</cascade>
<order-by>
<order-by-field name="createdOn" direction="DESC" />
</order-by>
</one-to-many>
<one-to-many field="queryResults" target-entity="QueryResults" mapped-by="queryRequest">
<cascade>
<cascade-persist />
</cascade>
</one-to-many>
</entity>
</doctrine-mapping>
QueryRequest.php は次のとおりです。
class QueryRequest {
protected $id;
protected $snapshot;
protected $custID;
protected $ipAddress;
protected $query;
protected $createdOn;
protected $httpRequestResponses = null;
protected $queryResults = null;
public function __construct() {
$this->setCreatedOn(new DateTime("now"));
$this->httpRequestResponses = new ArrayCollection();
$this->queryResults = new ArrayCollection();
}
public function getID() {
return $this->id;
}
public function getSnapshot() {
return $this->snapshot;
}
public function setSnapshot($snapshot) {
$this->snapshot = $snapshot;
}
public function getCustID() {
return $this->custID;
}
public function setCustID($id) {
$this->custID = $id;
}
public function getIpAddress() {
return $this->ipAddress;
}
public function setIpAddress($ip) {
$this->ipAddress = $ip;
}
public function getQuery() {
return $this->query;
}
public function setQuery($query) {
$this->query = $query;
}
public function getCreatedOn() {
return $this->createdOn;
}
public function setCreatedOn($createdOn) {
$this->createdOn = $createdOn;
}
}
私は新しいので、問題を見つけるのに苦労しています。実際、問題がxmlファイルにあるかどうかさえわかりません。誰でも問題を見つけるのを手伝ってもらえますか?