0
我有三個實體Stock
,StockDetail
和CatalogHasStock
。在CatalogHasStock
這是映射我有:如何通過Doctrine2中的另一個關係映射一個關係
/**
* @ORM\ManyToOne(targetEntity="StockBundle\Entity\StockDetail")
* @ORM\JoinColumns(@ORM\JoinColumn(name="product", referencedColumnName="product"),
* @ORM\JoinColumn(name="company", referencedColumnName="company"),
* @ORM\JoinColumn(name="stock_detail", referencedColumnName="id"),
* @ORM\JoinColumn(name="upc", referencedColumnName="upc"),
* @ORM\JoinColumn(name="kcondition", referencedColumnName="kcondition"))
*/
protected $stock;
在
StockDetail
這個
現在的映射:
/**
* @ORM\ManyToOne(targetEntity="StockBundle\Entity\Stock", inversedBy="sdetails")
* @ORM\JoinColumns(@ORM\JoinColumn(name="product", referencedColumnName="product"),
* @ORM\JoinColumn(name="company", referencedColumnName="company"),
* @ORM\JoinColumn(name="kcondition", referencedColumnName="kcondition"))
*/
protected $stock;
我需要CatalogHasStock
插入值,我這樣做:
$catalog_has_stock = new CatalogHasStock();
$catalog_has_stock->setStock($entityStockDetail);
但我得到這個錯誤:
Notice: Undefined index: product in /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 685
映射部分有什麼問題?