Skip to content

Instantly share code, notes, and snippets.

@daum
Created May 12, 2016 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daum/eccfc290bdc8c3b26d6bd9f639cad3d1 to your computer and use it in GitHub Desktop.
Save daum/eccfc290bdc8c3b26d6bd9f639cad3d1 to your computer and use it in GitHub Desktop.
<?php
$items = $em->getRepository('AppBundle:ExampleEntity')->findAll();
foreach($items as $i){
$c = new \ReflectionClass("AppBundle\\Entity\\ExampleEntity");
$prop = $c->getProperty('visible_label');
$prop->setAccessible(true);
$i->translate('en')->setVisibleLabel($prop->getValue($i));
$i->mergeNewTranslations();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment