/** * {@inheritdoc} */ protected function normalizeLabel(AssociationType $associationType) { $values = array(); foreach ($associationType->getTranslations() as $translation) { $values[sprintf('label-%s', $translation->getLocale())] = $translation->getLabel(); } return $values; }
/** * Test getter/setter for translations property */ public function testTranslations() { $this->assertCount(0, $this->associationType->getTranslations()); // Change value and assert new $newTranslation = new AssociationTypeTranslation(); $this->assertEntity($this->associationType->addTranslation($newTranslation)); $this->assertCount(1, $this->associationType->getTranslations()); $this->assertInstanceOf('Pim\\Bundle\\CatalogBundle\\Entity\\AssociationTypeTranslation', $this->associationType->getTranslations()->first()); $this->associationType->addTranslation($newTranslation); $this->assertCount(1, $this->associationType->getTranslations()); $this->assertEntity($this->associationType->removeTranslation($newTranslation)); $this->assertCount(0, $this->associationType->getTranslations()); }
/** * {@inheritDoc} */ public function getTranslations() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getTranslations', array()); return parent::getTranslations(); }