cloneAttribute example

return;
        }

        $clonedForm = $result->getClone();
        $clonedForm->setName('Copy of ' . $result->getName());

        $this->getManager()->persist($clonedForm);
        $this->getManager()->flush();

        $persister = Shopware()->Container()->get(DataPersister::class);
        $persister->cloneAttribute('s_cms_support_attributes', $id$clonedForm->getId());

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

    public function getFieldsAction()
    {
        $id = (int) $this->Request()->getParam('formId');
        if ($id === 0) {
            $this->View()->assign(['success' => false, 'message' => 'No valid form Id']);

            return;
        }
$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 */
protected $alias = 'stream';

    /** * @return void */
    public function copyStreamAttributesAction()
    {
        $sourceStreamId = $this->Request()->getParam('sourceStreamId');
        $targetStreamId = $this->Request()->getParam('targetStreamId');

        $persister = Shopware()->Container()->get(DataPersister::class);
        $persister->cloneAttribute(
            's_product_streams_attributes',
            $sourceStreamId,
            $targetStreamId
        );

        $this->View()->assign('success', true);
    }

    /** * @return void */
    

    }

    /** * Duplicates the category attributes from one category to another * * @param int $originalCategoryId * @param int $newCategoryId */
    public function duplicateCategoryAttributes($originalCategoryId$newCategoryId)
    {
        $this->attributePersister->cloneAttribute(
            's_categories_attributes',
            $originalCategoryId,
            $newCategoryId
        );
    }

    /** * Duplicates the category product associations from one category to another * * @param int $originalCategoryId * @param int $newCategoryId */
Home | Imprint | This part of the site doesn't use cookies.