protected function genericUpdateSeo(ModelCriteria $query, UpdateSeoEvent $event, EventDispatcherInterface $dispatcher = null)
    {
        if (null !== $object = $query->findPk($event->getObjectId())) {
            $object
                //for backward compatibility
                ->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher())

                ->setLocale($event->getLocale())
                ->setMetaTitle($event->getMetaTitle())
                ->setMetaDescription($event->getMetaDescription())
                ->setMetaKeywords($event->getMetaKeywords())

                ->save()
            ;

            // Update the rewritten URL, if required
            try {
                $object->setRewrittenUrl($event->getLocale(), $event->getUrl());
            } catch (UrlRewritingException $e) {
                throw new FormValidationException($e->getMessage(), $e->getCode());
            }

            $event->setObject($object);
        }

        return $object;
    }
protected function genericUpdateSeo(ModelCriteria $query, UpdateSeoEvent $event, EventDispatcherInterface $dispatcher = null)
    {
        if (null !== $object = $query->findPk($event->getObjectId())) {
            $object
                //for backward compatibility
                ->setDispatcher($dispatcher !== null ? $dispatcher : $event->getDispatcher())

                ->setLocale($event->getLocale())
                ->setMetaTitle($event->getMetaTitle())
                ->setMetaDescription($event->getMetaDescription())
                ->setMetaKeywords($event->getMetaKeywords())

                ->save()
            ;

            // Update the rewritten URL, if required
            try {
                $object->setRewrittenUrl($event->getLocale(), $event->getUrl());
            } catch (UrlRewritingException $e) {
                throw new FormValidationException($e->getMessage(), $e->getCode());
            }

            $event->setObject($object);
        }

        return $object;
    }
protected function genericUpdateSeo ( ModelCriteria $ query , UpdateSeoEvent $ event , EventDispatcherInterface $ dispatcher = null ) { if ( null !== $ object = $ query -> findPk ( $ event -> getObjectId ( ) ) ) { $ object //for backward compatibility -> setDispatcher ( $ dispatcher !== null ? $ dispatcher : $ event -> getDispatcher ( ) ) -> setLocale ( $ event -> getLocale ( ) ) -> setMetaTitle ( $ event -> getMetaTitle ( ) ) -> setMetaDescription ( $ event -> getMetaDescription ( ) ) -> setMetaKeywords ( $ event -> getMetaKeywords ( ) ) -> save ( ) ; // Update the rewritten URL, if required try { $ object -> setRewrittenUrl ( $ event -> getLocale ( ) , $ event -> getUrl ( ) ) ; } catch ( UrlRewritingException $ e ) { throw new FormValidationException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } $ event -> setObject ( $ object ) ; } return $ object ; }
Changes SEO Fields for an object.

@param ModelCriteria  $query
@param UpdateSeoEvent $event
@param EventDispatcherInterface $dispatcher

@return mixed                   an SEOxxx object
@throws FormValidationException if a rewritten URL cannot be created
Changes SEO Fields for an object .