setDevice example

case $emotion->getIsLandingPage() && $emotion->getParentId():
                $new->setParentId($emotion->getParentId());
                break;
            case $emotion->getIsLandingPage():
                $new->setParentId($emotion->getId());
                break;
        }

        $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());
        }
Home | Imprint | This part of the site doesn't use cookies.