テストデータ投入用に下記のバンドルを導入しました。
◯環境
OS: Windows
PHP: 5.5.x
Symfony: 2.8.1
Oracle: 11g
doctrine/data-fixtures
doctrine/doctrine-fixtures-bundle
hautelook/alice-bundle
Association Mappingするまでは、特に問題なくテストデータを投入できていました。
次のようなアソシエーションを張るとテストデータ投入時にFeature.product_idにNULL値が入るようになってしまいました。
php
1<?php 2use Doctrine\Common\Collections\ArrayCollection; 3 4/** @Entity */ 5class Product 6{ 7 // ... 8 /** 9 * @OneToMany(targetEntity="Feature", mappedBy="product") 10 */ 11 private $features; 12 // ... 13 14 public function __construct() { 15 $this->features = new ArrayCollection(); 16 } 17} 18 19/** @Entity */ 20class Feature 21{ 22 // ... 23 /** 24 * @ManyToOne(targetEntity="Product", inversedBy="features") 25 * @JoinColumn(name="product_id", referencedColumnName="id") 26 */ 27 private $product; 28 // ... 29} 30
◯参考サイト
association-mapping.html
◯product_feature.yml
yml
1App\ExampleBundle\Entity\Product: 2 product: 3 id: 1 4 5App\ExampleBundle\Entity\Feature: 6 feature: 7 #product_id: @product->id 8 product_id: 1
ProductのINSERTは問題起きず、FeatureのINSERTで問題が起きました。
oci_execute(): ORA-01400: ("TEST"."FEATURE"."PRODUCT_ID")にはNULLは挿入できません。
*直接値を指定しても同じくエラーとなってしまいました。
原因がさっぱり分からず、詰まってる状態です。
何かわかる方いましたらご教示いただけないでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。