protected function edit(array $values = array())
    {
        $values =
            $this->dispatchBeforeOperationEvent(
                '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeSeoEditingEvent',
                SeoEvents::BEFORE_EDIT_SEO,
                $values,
                array(
                    'message' => 'exception_seo_editing_aborted',
                    'domain' => 'exceptions',
                )
            );

        try {
            if (isset($values['Permalink'])) {
                $currentPermalink = $this->alSeo->getPermalink();
                if ($values['Permalink'] != $currentPermalink) {
                    $values["oldPermalink"] = $currentPermalink;
                    $values['Permalink'] = PageManager::slugify($values["Permalink"]);
                } else {
                    unset($values['Permalink']);
                }
            }

            if (isset($values['MetaTitle']) && $values['MetaTitle'] == $this->alSeo->getMetaTitle()) {
                unset($values['MetaTitle']);
            }

            if (isset($values['MetaDescription']) && $values['MetaDescription'] == $this->alSeo->getMetaDescription()) {
                unset($values['MetaDescription']);
            }

            if (isset($values['MetaKeywords']) && $values['MetaKeywords'] == $this->alSeo->getMetaKeywords()) {
                unset($values['MetaKeywords']);
            }

            $this->validator->checkEmptyParams($values);
            $this->validator->checkOnceValidParamExists(array('Permalink' => '', 'MetaTitle' => '', 'MetaDescription' => '', 'MetaKeywords' => '', 'SitemapChangefreq' => '', 'SitemapPriority' => ''), $values);

            $this->seoRepository->startTransaction();
            $this->seoRepository->setRepositoryObject($this->alSeo);

            $result = (!empty($values)) ? $this->seoRepository->save($values) : true;

            if (false !== $result) {
                $eventName = SeoEvents::BEFORE_EDIT_SEO_COMMIT;
                $result = !$this->eventsHandler
                                ->createEvent($eventName, '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeEditSeoCommitEvent', array($this, $values))
                                ->dispatch()
                                ->getEvent($eventName)
                                ->isAborted();
            }

            if (false !== $result) {
                $this->seoRepository->commit();

                $this->eventsHandler
                     ->createEvent(SeoEvents::AFTER_EDIT_SEO, '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\AfterSeoEditedEvent', array($this))
                     ->dispatch();

                return $result;
            }

            $this->seoRepository->rollBack();

            return $result;
        } catch (General\EmptyArgumentsException $ex) {
        } catch (General\ArgumentExpectedException $ex) {
        } catch (\Exception $e) {
            if (isset($this->seoRepository) && $this->seoRepository !== null) {
                $this->seoRepository->rollBack();
            }

            throw $e;
        }
    }
protected function edit(array $values = array())
    {
        $values =
            $this->dispatchBeforeOperationEvent(
                '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeSeoEditingEvent',
                SeoEvents::BEFORE_EDIT_SEO,
                $values,
                array(
                    'message' => 'exception_seo_editing_aborted',
                    'domain' => 'exceptions',
                )
            );

        try {
            if (isset($values['Permalink'])) {
                $currentPermalink = $this->alSeo->getPermalink();
                if ($values['Permalink'] != $currentPermalink) {
                    $values["oldPermalink"] = $currentPermalink;
                    $values['Permalink'] = PageManager::slugify($values["Permalink"]);
                } else {
                    unset($values['Permalink']);
                }
            }

            if (isset($values['MetaTitle']) && $values['MetaTitle'] == $this->alSeo->getMetaTitle()) {
                unset($values['MetaTitle']);
            }

            if (isset($values['MetaDescription']) && $values['MetaDescription'] == $this->alSeo->getMetaDescription()) {
                unset($values['MetaDescription']);
            }

            if (isset($values['MetaKeywords']) && $values['MetaKeywords'] == $this->alSeo->getMetaKeywords()) {
                unset($values['MetaKeywords']);
            }

            $this->validator->checkEmptyParams($values);
            $this->validator->checkOnceValidParamExists(array('Permalink' => '', 'MetaTitle' => '', 'MetaDescription' => '', 'MetaKeywords' => '', 'SitemapChangefreq' => '', 'SitemapPriority' => ''), $values);

            $this->seoRepository->startTransaction();
            $this->seoRepository->setRepositoryObject($this->alSeo);

            $result = (!empty($values)) ? $this->seoRepository->save($values) : true;

            if (false !== $result) {
                $eventName = SeoEvents::BEFORE_EDIT_SEO_COMMIT;
                $result = !$this->eventsHandler
                                ->createEvent($eventName, '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeEditSeoCommitEvent', array($this, $values))
                                ->dispatch()
                                ->getEvent($eventName)
                                ->isAborted();
            }

            if (false !== $result) {
                $this->seoRepository->commit();

                $this->eventsHandler
                     ->createEvent(SeoEvents::AFTER_EDIT_SEO, '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\AfterSeoEditedEvent', array($this))
                     ->dispatch();

                return $result;
            }

            $this->seoRepository->rollBack();

            return $result;
        } catch (General\EmptyArgumentsException $ex) {
        } catch (General\ArgumentExpectedException $ex) {
        } catch (\Exception $e) {
            if (isset($this->seoRepository) && $this->seoRepository !== null) {
                $this->seoRepository->rollBack();
            }

            throw $e;
        }
    }
protected function edit ( array $ values = array ( ) ) { $ values = $ this -> dispatchBeforeOperationEvent ( '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeSeoEditingEvent' , SeoEvents :: BEFORE_EDIT_SEO , $ values , array ( 'message' => 'exception_seo_editing_aborted' , 'domain' => 'exceptions' , ) ) ; try { if ( isset ( $ values [ 'Permalink' ] ) ) { $ currentPermalink = $ this -> alSeo -> getPermalink ( ) ; if ( $ values [ 'Permalink' ] != $ currentPermalink ) { $ values [ "oldPermalink" ] = $ currentPermalink ; $ values [ 'Permalink' ] = PageManager :: slugify ( $ values [ "Permalink" ] ) ; } else { unset ( $ values [ 'Permalink' ] ) ; } } if ( isset ( $ values [ 'MetaTitle' ] ) && $ values [ 'MetaTitle' ] == $ this -> alSeo -> getMetaTitle ( ) ) { unset ( $ values [ 'MetaTitle' ] ) ; } if ( isset ( $ values [ 'MetaDescription' ] ) && $ values [ 'MetaDescription' ] == $ this -> alSeo -> getMetaDescription ( ) ) { unset ( $ values [ 'MetaDescription' ] ) ; } if ( isset ( $ values [ 'MetaKeywords' ] ) && $ values [ 'MetaKeywords' ] == $ this -> alSeo -> getMetaKeywords ( ) ) { unset ( $ values [ 'MetaKeywords' ] ) ; } $ this -> validator -> checkEmptyParams ( $ values ) ; $ this -> validator -> checkOnceValidParamExists ( array ( 'Permalink' => '' , 'MetaTitle' => '' , 'MetaDescription' => '' , 'MetaKeywords' => '' , 'SitemapChangefreq' => '' , 'SitemapPriority' => '' ) , $ values ) ; $ this -> seoRepository -> startTransaction ( ) ; $ this -> seoRepository -> setRepositoryObject ( $ this -> alSeo ) ; $ result = ( ! empty ( $ values ) ) ? $ this -> seoRepository -> save ( $ values ) : true ; if ( false !== $ result ) { $ eventName = SeoEvents :: BEFORE_EDIT_SEO_COMMIT ; $ result = ! $ this -> eventsHandler -> createEvent ( $ eventName , '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeEditSeoCommitEvent' , array ( $ this , $ values ) ) -> dispatch ( ) -> getEvent ( $ eventName ) -> isAborted ( ) ; } if ( false !== $ result ) { $ this -> seoRepository -> commit ( ) ; $ this -> eventsHandler -> createEvent ( SeoEvents :: AFTER_EDIT_SEO , '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\AfterSeoEditedEvent' , array ( $ this ) ) -> dispatch ( ) ; return $ result ; } $ this -> seoRepository -> rollBack ( ) ; return $ result ; } catch ( General \ EmptyArgumentsException $ ex ) { } catch ( General \ ArgumentExpectedException $ ex ) { } catch ( \ Exception $ e ) { if ( isset ( $ this -> seoRepository ) && $ this -> seoRepository !== null ) { $ this -> seoRepository -> rollBack ( ) ; } throw $ e ; } }
Edits the managed page attributes object

@param  array                                                                                     $values
@return boolean
@throws \RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Exception\Content\General\InvalidArgumentTypeException

@api
Edits the managed page attributes object