databaseMap = Propel::getDatabaseMap('bookstore'); } public function testOneToMany() { $bookTable = $this->databaseMap->getTableByPhpName('Book'); $bookToAuthor = $bookTable->getRelation('Author'); $authorTable = $this->databaseMap->getTableByPhpName('Author'); $authorToBook = $authorTable->getRelation('Book'); $this->assertEquals($authorToBook, $bookToAuthor->getSymmetricalRelation()); $this->assertEquals($bookToAuthor, $authorToBook->getSymmetricalRelation()); } public function testOneToOne() { $accountTable = $this->databaseMap->getTableByPhpName('BookstoreEmployeeAccount'); $accountToEmployee = $accountTable->getRelation('BookstoreEmployee'); $employeeTable = $this->databaseMap->getTableByPhpName('BookstoreEmployee'); $employeeToAccount = $employeeTable->getRelation('BookstoreEmployeeAccount'); $this->assertEquals($accountToEmployee, $employeeToAccount->getSymmetricalRelation()); $this->assertEquals($employeeToAccount, $accountToEmployee->getSymmetricalRelation()); } public function testSeveralRelationsOnSameTable() { $authorTable = $this->databaseMap->getTableByPhpName('Author'); $authorToEssay = $authorTable->getRelation('EssayRelatedByFirstAuthor'); $essayTable = $this->databaseMap->getTableByPhpName('Essay'); $essayToAuthor = $essayTable->getRelation('AuthorRelatedByFirstAuthor'); $this->assertEquals($authorToEssay, $essayToAuthor->getSymmetricalRelation()); $this->assertEquals($essayToAuthor, $authorToEssay->getSymmetricalRelation()); } public function testCompositeForeignKey() { $favoriteTable = $this->databaseMap->getTableByPhpName('ReaderFavorite'); $favoriteToOpinion = $favoriteTable->getRelation('BookOpinion'); $opinionTable = $this->databaseMap->getTableByPhpName('BookOpinion'); $opinionToFavorite = $opinionTable->getRelation('ReaderFavorite'); $this->assertEquals($favoriteToOpinion, $opinionToFavorite->getSymmetricalRelation()); $this->assertEquals($opinionToFavorite, $favoriteToOpinion->getSymmetricalRelation()); } }