Returns an array of property names which values should be protected
against duplication when adding new locale
public getCopyingSensitiveProperties ( ) : array | ||
Résultat | array |
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); } }