public function __construct($symbol, $initialOfferingPrice, Market $market) { $this->symbol = $symbol; $this->price = $initialOfferingPrice; $this->market = $market; $market->addStock($this); }
public function testManyToOneDQL() { $dql = "SELECT m, s FROM Doctrine\\Tests\\Models\\StockExchange\\Market m JOIN m.stocks s WHERE m.id = ?1"; $market = $this->_em->createQuery($dql)->setParameter(1, $this->market->getId())->getSingleResult(); $this->assertEquals(2, count($market->stocks)); $this->assertTrue(isset($market->stocks['AAPL']), "AAPL symbol has to be key in indexed association."); $this->assertTrue(isset($market->stocks['GOOG']), "GOOG symbol has to be key in indexed association."); $this->assertEquals("AAPL", $market->stocks['AAPL']->getSymbol()); $this->assertEquals("GOOG", $market->stocks['GOOG']->getSymbol()); }