@param AbstractEntity $entity

@return Seo
540240
public function findOrCreateFor(AbstractEntity $entity)
    {
        $seo = $this->findFor($entity);

        if (is_null($seo)) {
            $seo = new Seo();
            $seo->setRef($entity);
        }

        return $seo;
    }
289344
public function save(Entity $entity) {
    $this->_em->persist($entity);
    $this->_em->flush();
    return $this;
  }
599878
public function setEntity($entity)
    {
        if ($this->isRegistryEntity(get_class($entity))) {
            $this->classname = get_class($entity);
        }
        $this->entity = $entity;

        return $this;
    }
144108
public function remove(Entity $entity) {
    if (method_exists($entity,'remove')) {
      $entity->remove();
    }
    $this->_em->remove($entity);
    
    return $this;
  }
1315474
public function remove(AbstractEntity $entity)
    {
        for ($i = count($this->registries) - 1; $i >= 0; $i--) {
            /** @var RegistryInterface $registry */
            $registry = $this->registries[ $i ];
            $registry->remove($entity->getId());
        }
    }
682431
protected function _getTitle($entity)
    {
        $title = $entity->page_title;
        if ((bool)$entity->display_page_title_suffix) {
            $title .= WasabiCms::titleSuffix();
        }
        return $title;
    }
781338
public function getTitleForPageOrDefault(AbstractPage $entity = null, $default = null)
    {
        if (is_null($entity)) {
            return $default;
        }

        $arr = array();

        $arr[] = $this->getSeoTitle($entity);

        $arr[] = $default;

        $arr[] = $entity->getTitle();

        return $this->getPreferredValue($arr);
    }
215869
public function getSaverForEntity(
        EntityInterface $entity
    ): EntitySaverInterface {
        $fqn = $this->getEntityNamespace($entity);

        return $this->getSaverForEntityFqn($fqn);
    }
886634
public function transform($entity)
    {
        if (null === $entity) {
            return $entity;
        }

        $accessor = PropertyAccess::createPropertyAccessor();

        return $accessor->getValue($entity, 'id');
    }
476273
private static function decrypt_entity( FS_Entity $entity ) {
            $clone = clone $entity;
            $props = get_object_vars( $entity );

            foreach ( $props as $key => $val ) {
                $clone->{$key} = self::_decrypt( $val );
            }

            return $clone;
        }
143036
public function setMainUrl($entity)
    {
        // set main to first entry or to null
        if ($entity->getUrls()->isEmpty()) {
            $entity->setMainUrl(null);
        } else {
            $entity->setMainUrl($entity->getUrls()->first()->getUrl());
        }
    }
175792
protected function updateRow(AbstractEntity $entity)
    {
        $values = $entity->getDbValues();

        $query = $this->getSqlObject()
            ->update()
            ->set($values)
            ->where($this->getPrimaryKeyWheres($entity));

        $this->execute($query);
    }
234225
public function getPositionFieldByEntity($entity)
    {
        if (is_object($entity)) {
            $entity = ClassUtils::getClass($entity);
        }

        if (isset($this->positionField['entities'][$entity])) {
            return $this->positionField['entities'][$entity];

        } else {
            return $this->positionField['default'];
        }
    }
108150
public function mergeEntity($entity) {
		ArgUtils::assertTrue(is_object($entity));
		
		$objHash = spl_object_hash($entity);
		if (isset($this->mergedEntity[$objHash])) {
			return $this->mergedEntity[$objHash];
		}
		
		$em = $this->actionQueue->getEntityManager();
		$persistenceContext = $em->getPersistenceContext();
		
		if ($entity instanceof EntityProxy 
				&& !$persistenceContext->getEntityProxyManager()->isProxyInitialized($entity)) {
			return $this->mergedEntity[$objHash] = $entity;
		}
		
		$entityInfo = $em->getPersistenceContext()->getEntityInfo(
				$entity, $em->getEntityModelManager());
		
		$this->mergedEntity[$objHash] = $mergedEntity = $this->createMergedEntity($entityInfo, $entity);
		
		$this->mergeProperties($entityInfo->getEntityModel(), $entity, $mergedEntity);
		
		return $mergedEntity;
	}
845333
protected function patchRow(AbstractEntity $entity)
    {
        $values = $entity->getChangedDbValues();
        if (empty($values)) {
            return;
        }

        $query = $this->getSqlObject()
            ->update()
            ->set($values)
            ->where($this->getPrimaryKeyWheres($entity));

        $this->execute($query);
    }
1130144
public function robots($entity)
    {
        $robots = [];

        $index = (bool)Configure::read('Settings.Cms.SEO.meta-robots-index');
        if ($entity->meta_robots_index !== null) {
            $index = $entity->meta_robots_index;
        }
        $robots[] = ($index) ? 'index' : 'noindex';

        $follow = (bool)Configure::read('Settings.Cms.SEO.meta-robots-follow');
        if ($entity->meta_robots_follow !== null) {
            $follow = $entity->meta_robots_follow;
        }
        $robots[] = ($follow) ? 'follow' : 'nofollow';

        $noodp = (bool)Configure::read('Settings.Cms.SEO.meta-robots-noodp') || !empty($entity->meta_description);
        if ($noodp) {
            $robots[] = 'noodp';
        }

        return $this->_render(self::ATTR_NAME, __FUNCTION__, join(',', $robots));
    }
38093
public function flush($entity = null)
    {
        if ($entity !== null) {
            $this->persist($entity);
        }

        return $this->getEntityManager()->flush();
    }