2 namespace Doctrine\Tests\Models\StockExchange;
4 use Doctrine\Common\Collections\ArrayCollection;
7 * Bonds have many stocks. This uses a many to many assocation and fails to model how many of a
8 * particular stock a bond has. But i Need a many-to-many assocation, so please bear with my modelling skills ;)
11 * @Table(name="exchange_bonds")
16 * @Id @GeneratedValue @column(type="integer")
22 * @column(type="string")
28 * @ManyToMany(targetEntity="Stock", indexBy="symbol")
29 * @JoinTable(name="exchange_bonds_stocks")
34 public function __construct($name)
39 public function getId()
44 public function addStock(Stock $stock)
46 $this->stocks[$stock->getSymbol()] = $stock;