Created
August 23, 2017 03:52
-
-
Save cod1ingcoding/1bb92b30b23b215860de140f4e2df43b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Eorder.php | |
use Doctrine\Common\Collections\ArrayCollection; | |
/** | |
* @Entity @Table(name="e_orders", options={"collate"="utf8_general_ci"}) | |
*/ | |
class Eorder | |
{ | |
/** | |
* @var integer | |
* @Id @GeneratedValue @Column(type="integer", name="order_id") | |
*/ | |
protected $id; | |
public function getId() { return $this->id; } | |
/** | |
* @var OrderStockBatch[]|ArrayCollection | |
* @OneToMany(targetEntity="Eitem", mappedBy="order") | |
*/ | |
protected $items; | |
public function __construct() { | |
$this->items = new ArrayCollection(); | |
} | |
public function getItems() { return $this->items; } | |
public function setItems($items) { $this->items = $items; return $this; } | |
} | |
// Eitem.php | |
/** | |
* @Entity @Table(name="e_items", options={"collate"="utf8_general_ci"}) | |
*/ | |
class Eitem | |
{ | |
/** | |
* @var integer | |
* @Id @GeneratedValue @Column(type="integer", name="item_id") | |
*/ | |
protected $id; | |
public function getId() { return $this->id; } | |
public function __construct() | |
{ | |
} | |
/** | |
* @var Eorder | |
* @ManyToOne(targetEntity="Eorder", inversedBy="items") | |
* @JoinColumn(name="order_id", referencedColumnName="order_id", onDelete="CASCADE") // 不用双向无法join column 到 item表 | |
*/ | |
protected $order; | |
/** | |
* @var integer | |
* @Column(type="integer", name="order_stock_batch_qty") | |
*/ | |
protected $qty; | |
public function getQty() { return $this->qty; } | |
public function setQty($qty) { $this->qty = $qty; return $this; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment