/** * Process translations of an operator. * * @param ObjectManager $manager * @param Operator $operator * @param \DOMNodeList $translations */ protected function processTranslations($manager, $operator, $translations) { /** @var $node DOMNode */ foreach ($translations as $node) { $translation = new OperatorTranslation(); $translation->setLocale($node->getAttribute('locale')); $translation->setName($node->nodeValue); $translation->setOperator($operator); $operator->addTranslation($translation); $manager->persist($translation); } }
protected function createSimpleOperator($type, $inputType, $operatorValue, $name, $locale = 'de') { $operator = new Operator(); $operator->setType($type); $operator->setInputType($inputType); $operator->setOperator($operatorValue); $translation = new OperatorTranslation(); $translation->setLocale($locale); $translation->setName($name); $translation->setOperator($operator); $this->em->persist($operator); $this->em->persist($translation); return $operator; }