Bundle/SeoBundle/Helper/PageSeoHelper.php
public function updateSeoByEntity(BasePage $page, $entity)
    {
        //if no entity is provided
        if ($entity === null) {
            //we look for the entity of the page
            if ($page->getBusinessEntity() !== null) {
                $entity = $page->getBusinessEntity();
            }
        }

        //only if we have an entity instance
        if ($entity !== null) {
            //the page seo
            $pageSeo = $page->getSeo();

            //the page seo might not exist yet
            if ($pageSeo !== null) {
                $businessEntity = $this->businessEntityHelper->findByEntityInstance($entity);

                if ($businessEntity !== null) {
                    $businessProperties = $businessEntity->getBusinessPropertiesByType('seoable');

                    //parse the business properties
                    foreach ($businessProperties as $businessProperty) {
                        //parse of seo attributes
                        foreach ($this->pageSeoAttributes as $seoAttribute) {
                            $value = $this->getEntityAttributeValue($pageSeo, $seoAttribute);
                            // we only update value if its a string and (if its a VBP or its a BP where value is not defined)
                            if (is_string($value) && ($page instanceof VirtualBusinessPage || ($page instanceof BusinessPage && $value == null))) {
                                $value = $this->parameterConverter->setBusinessPropertyInstance(
                                    $value,
                                    $businessProperty,
                                    $entity
                                );
                            }
                            $this->setEntityAttributeValue($pageSeo, $seoAttribute, $value);
                        }
                    }
                }
            }
        }
    }
public function updateSeoByEntity(BasePage $page, $entity)
    {
        //if no entity is provided
        if ($entity === null) {
            //we look for the entity of the page
            if ($page->getBusinessEntity() !== null) {
                $entity = $page->getBusinessEntity();
            }
        }

        //only if we have an entity instance
        if ($entity !== null) {
            //the page seo
            $pageSeo = $page->getSeo();

            //the page seo might not exist yet
            if ($pageSeo !== null) {
                $businessEntity = $this->businessEntityHelper->findByEntityInstance($entity);

                if ($businessEntity !== null) {
                    $businessProperties = $businessEntity->getBusinessPropertiesByType('seoable');

                    //parse the business properties
                    foreach ($businessProperties as $businessProperty) {
                        //parse of seo attributes
                        foreach ($this->pageSeoAttributes as $seoAttribute) {
                            $value = $this->getEntityAttributeValue($pageSeo, $seoAttribute);
                            // we only update value if its a string and (if its a VBP or its a BP where value is not defined)
                            if (is_string($value) && ($page instanceof VirtualBusinessPage || ($page instanceof BusinessPage && $value == null))) {
                                $value = $this->parameterConverter->setBusinessPropertyInstance(
                                    $value,
                                    $businessProperty,
                                    $entity
                                );
                            }
                            $this->setEntityAttributeValue($pageSeo, $seoAttribute, $value);
                        }
                    }
                }
            }
        }
    }
public function updateSeoByEntity ( BasePage $ page , $ entity ) { //if no entity is provided if ( $ entity === null ) { //we look for the entity of the page if ( $ page -> getBusinessEntity ( ) !== null ) { $ entity = $ page -> getBusinessEntity ( ) ; } } //only if we have an entity instance if ( $ entity !== null ) { //the page seo $ pageSeo = $ page -> getSeo ( ) ; //the page seo might not exist yet if ( $ pageSeo !== null ) { $ businessEntity = $ this -> businessEntityHelper -> findByEntityInstance ( $ entity ) ; if ( $ businessEntity !== null ) { $ businessProperties = $ businessEntity -> getBusinessPropertiesByType ( 'seoable' ) ; //parse the business properties foreach ( $ businessProperties as $ businessProperty ) { //parse of seo attributes foreach ( $ this -> pageSeoAttributes as $ seoAttribute ) { $ value = $ this -> getEntityAttributeValue ( $ pageSeo , $ seoAttribute ) ; // we only update value if its a string and (if its a VBP or its a BP where value is not defined) if ( is_string ( $ value ) && ( $ page instanceof VirtualBusinessPage || ( $ page instanceof BusinessPage && $ value == null ) ) ) { $ value = $ this -> parameterConverter -> setBusinessPropertyInstance ( $ value , $ businessProperty , $ entity ) ; } $ this -> setEntityAttributeValue ( $ pageSeo , $ seoAttribute , $ value ) ; } } } } } }
Generate a seo for the page using the current entity.

@param Page   $page
@param Entity $entity
Generate a seo for the page using the current entity .