/** * Test foreign key relationships based on references to unique cols but not PK. * @link http://propel.phpdb.org/trac/ticket/691 */ public function testUniqueFkRel() { BookstoreEmployeeAccountTableMap::doDeleteAll(); $employee = new BookstoreEmployee(); $employee->setName("Johnny Walker"); $acct = new BookstoreEmployeeAccount(); $acct->setBookstoreEmployee($employee); $acct->setLogin("test-login"); $acct->save(); $acctId = $acct->getEmployeeId(); $al = new AcctAuditLog(); $al->setBookstoreEmployeeAccount($acct); $al->save(); $alId = $al->getId(); BookstoreEmployeeTableMap::clearInstancePool(); BookstoreEmployeeAccountTableMap::clearInstancePool(); AcctAuditLogTableMap::clearInstancePool(); $al2 = AcctAuditLogQuery::create()->findPk($alId); /* @var $al2 AcctAuditLog */ $mapacct = $al2->getBookstoreEmployeeAccount(); $lookupacct = BookstoreEmployeeAccountQuery::create()->findPk($acctId); $logs = $lookupacct->getAcctAuditLogs(); $this->assertTrue(count($logs) == 1, "Expected 1 audit log result."); $this->assertEquals($logs[0]->getId(), $al->getId(), "Expected returned audit log to match created audit log."); }