/** * Test foreign key relationships based on references to unique cols but not PK. * @link http://trac.propelorm.org/ticket/691 */ public function testUniqueFkRel() { BookstoreEmployeeAccountPeer::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(); BookstoreEmployeePeer::clearInstancePool(); BookstoreEmployeeAccountPeer::clearInstancePool(); AcctAuditLogPeer::clearInstancePool(); $al2 = AcctAuditLogPeer::retrieveByPK($alId); /* @var $al2 AcctAuditLog */ $mapacct = $al2->getBookstoreEmployeeAccount(); $lookupacct = BookstoreEmployeeAccountPeer::retrieveByPK($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."); }