public function testReadOnlyRelations() { //add countries CountryTranslationQuery::create()->deleteAll(); CountryQuery::create()->deleteAll(); $stmt = $this->con->prepare('INSERT INTO country VALUES (?, ?)'); $stmt->execute(['fr', 'Paris']); $stmt->execute(['us', 'Washington']); $stmt->execute(['de', 'Berlin']); $stmt = $this->con->prepare('INSERT INTO country_translation (country_code, language_code, label) VALUES (?, ?, ?)'); $stmt->execute(['fr', 'fr_FR', 'France']); $stmt->execute(['us', 'us_US', 'United States America']); $stmt->execute(['de', 'de_DE', 'Berlin']); $contest = new Contest(); $contest->setName('Symfony Live 2014'); $contest->setCountryCode('fr'); $contest->save(); ContestTableMap::clearInstancePool(); $contestDb = ContestQuery::create()->joinWith('Contest.Country')->joinWith('Country.CountryTranslation')->findPk($contest->getId()); $translations = $contestDb->getCountry()->getCountryTranslations(); $this->assertCount(1, $translations); $this->assertEquals('France', $translations[0]->getLabel()); }