Snippet example


        $snippets = $this->Request()->getPost();
        $isSingleSnippet = false;
        $result = [];

        if (\array_key_exists('namespace', $snippets)) {
            $snippets = [$snippets];
            $isSingleSnippet = true;
        }

        foreach ($snippets as $params) {
            $snippet = new Snippet();
            $snippet->fromArray($params);
            $snippet->setDirty(true);

            if (!$this->isSnippetValid($snippet)) {
                $result[$snippet->getId()] = $params;
                continue;
            }

            try {
                $this->get('models')->persist($snippet);
                $this->get('models')->flush();
            }
Home | Imprint | This part of the site doesn't use cookies.