Created
December 7, 2019 15:54
-
-
Save theodesp/d7bc05cfc290a98e9938053aebbf2972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$entityManager = $this->getDoctrine()->getManager(); | |
$product = new \App\Entity\Product(); | |
$product->setId(1000); | |
$product->setPrice(1000); | |
$product->translate('de')->setName('Schuhe'); | |
$product->translate('de')->setDescription('Schuhe'); | |
$product->translate('en')->setName('Shoes'); | |
$product->translate('en')->setDescription('Shoes'); | |
$entityManager->persist($product); | |
// In order to persist new translations, call mergeNewTranslations method, before flush | |
$product->mergeNewTranslations(); | |
$entityManager->flush(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment