copyEmotionTranslations example

$copyName = $emotion->getName() . ' - Copy';
        $new->setName($copyName);

        $new->setDevice($device);
        $new->setCreateDate(new DateTime());
        $new->setModified(new DateTime());

        $this->get('models')->persist($new);
        $this->get('models')->flush();

        if (!empty($new->getId())) {
            $this->copyEmotionTranslations((int) $emotion->getId()(int) $new->getId());
            $this->copyElementTranslations($emotion$new);
            $persister = Shopware()->Container()->get(DataPersister::class);
            $persister->cloneAttribute('s_emotion_attributes', $emotion->getId()$new->getId());
        }

        $this->View()->assign(['success' => true, 'data' => []]);
    }

    /** * Controller action to create a new template. * Use the internal "saveTemplate" function. * The request parameters are used as template/model data. * * @return void */
Home | Imprint | This part of the site doesn't use cookies.