Author: Adam Piotrowski (adam@wellcommerce.org)
Ejemplo n.º 1
0
 protected function copyTranslatableEntity(LocaleAwareInterface $entity, LocaleInterface $targetLocale)
 {
     $duplicate = clone $entity;
     foreach ($entity->getCopyingSensitiveProperties() as $propertyName) {
         $value = sprintf('%s-%s', $this->propertyAccessor->getValue($entity, $propertyName), $targetLocale->getCode());
         $this->propertyAccessor->setValue($duplicate, $propertyName, $value);
         $duplicate->setLocale($targetLocale->getCode());
         $this->entityManager->persist($duplicate);
     }
 }
 /**
  * Transforms single translation
  *
  * @param LocaleAwareInterface $translation
  * @param array                $fields
  * @param array                $values
  */
 protected function transformTranslation(LocaleAwareInterface $translation, $fields, &$values)
 {
     foreach ($fields as $field) {
         $values[$translation->getLocale()][$field] = $this->propertyAccessor->getValue($translation, $field);
     }
 }