getDirty example


    public function updateSnippetAction()
    {
        $snippets = $this->Request()->getParam('snippets', []);

        // Batch mode         if (!empty($snippets)) {
            foreach ($snippets as $snippet) {
                /** @var Snippet $snippetModel */
                $snippetModel = $this->get('models')->getRepository(Snippet::class)->find($snippet['id']);
                $dirty = $snippetModel->getDirty() || strcmp($snippetModel->getValue()$snippet['value']) != 0;
                $snippetModel->setDirty($dirty);
                $snippetModel->setValue($snippet['value']);

                if (!$this->isSnippetValid($snippetModel)) {
                    $this->get('models')->remove($snippetModel);
                    continue;
                }
            }
            $this->get('models')->flush();
            $this->View()->assign(['success' => true]);

            
Home | Imprint | This part of the site doesn't use cookies.