1

CodeIgniterをDoctrine2と統合しようとしています。1つのオブジェクトのプロパティを保存できないことを除いて、すべてがうまく機能しています。

ここに奇妙なエラーをスローする小さなコードスニペットがあります

$account = $this->em->getRepository('Entities\Account')->findOneById($accountId);

$ofx = new \Entities\FinancialRecord();
$a = $accountCatDao->findByPayeeName("PETROCAN", $account);

ofx->setAccount($account);
$ofx->setAmount($b->getAmount());
$ofx->setDatePosted(new DateTime());
$ofx->setDateUser(new DateTime());
$ofx->setPayeeCity($b->getPayeeCity());
$ofx->setPayeeName($b->getPayeeName());
$ofx->setPayeeState($b->getPayeeState());
$ofx->setTransactionId($b->getTransactionId());
$ofx->setTransactionType($b->getTransactionType());

// FOLLOWING LINE CAUSING THE PROBLEM
$ofx->setCategory($a->getCategory());

$this->em->persist($ofx);
$this->em->flush();

エラーがスローされました

Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'No mapping file found named 'Proxies.__CG__.Entities.Category.dcm.yml' for class 'Proxies\__CG__\Entities\Category'.' in      /Users/yannlaviolette/Sites/finance/application/libraries/Doctrine/ORM/Mapping/MappingException.php on line 68

(!)

Doctrine\ORM\Mapping\MappingException: No mapping file found named 'Proxies.__CG__.Entities.Category.dcm.yml' for class 'Proxies\__CG__\Entities\Category'. in /Users/yannlaviolette/Sites/finance/application/libraries/Doctrine/ORM/Mapping/MappingException.php on line 68

私のマッピングオブジェクト

Entities\FinancialRecord:
   type: entity
   table: finance.financial_record
   fields:
      id:
         id: true
         type: bigint
  nullable: false
  generator:
    strategy: SEQUENCE
transactionId:
  type: string
  length: 255
  fixed: false
  nullable: false
  column: transaction_id
transactionType:
  type: string
  length: 10
  fixed: false
  nullable: false
  column: transaction_type
datePosted:
  type: datetimetz
  nullable: false
  column: date_posted
dateUser:
  type: datetimetz
  nullable: false
  column: date_user
payeeName:
  type: string
  length: 255
  fixed: false
  nullable: false
  column: payee_name
payeeCity:
  type: string
  length: 255
  fixed: false
  nullable: false
  column: payee_city
payeeState:
  type: string
  length: 3
  fixed: false
  nullable: false
  column: payee_state
amount:
  type: decimal
  nullable: false
manyToOne:
   category:
      targetEntity: Entities\Category
      cascade: ["persist", "merge"]
    account:
      targetEntity: Entities\Account
      cascade: ["persist", "merge"]
lifecycleCallbacks: {  }

私は本当に考えがありません。この問題に2日間費やしました。誰かが私を助けてくれますか?

ヤン

4

1 に答える 1

0

1つのプロジェクトにmanyToOneリレーションがあります。

あなたのymlファイルと比較して私が見る唯一の違いは、私がEntities\CategorytargetEntityとしてではなく、単にCategory

私の特定の実装の例:

manyToOne:
    Order:
        targetEntity: Order
    Product:
        targetEntity: Product
于 2012-10-31T12:03:36.417 に答える