@param \Doctrine\ORM\EntityManager $em

@return PageInterface
353210
public function getPage(EntityManager $em)
    {
        return $em->getRepository($this->getPageEntityname())->find($this->getPageId());
    }
106824
public static function getScheduledEntityInsertionsByClassname(EntityManager $em, $classnames)
    {
        $entities = array();
        $classnames = (array) $classnames;

        foreach ($em->getUnitOfWork()->getScheduledEntityInsertions() as $entity) {
            if (true === in_array(ClassUtils::getRealClass($entity), $classnames)) {
                $entities[] = $entity;
            }
        }

        return $entities;
    }
813939
public function getManagerForEntity($entity): EntityManagerInterface
    {
        $class = ClassUtils::getClass($entity);
        $entityManager = $this->doctrine->getManagerForClass($class);
        if (!$entityManager instanceof EntityManagerInterface) {
            throw new \InvalidArgumentException("No manager found for class {$class}");
        }

        return $entityManager;
    }
295534
public static function getScheduledAClassContentInsertions(EntityManager $em, $with_revision = false, $exclude_base_element = false)
    {
        $entities = array();
        foreach ($em->getUnitOfWork()->getScheduledEntityInsertions() as $entity) {
            if (false !== $tmp = self::getScheduledEntity($entity, $with_revision, $exclude_base_element)) {
                $entities[] = $tmp;
            }
        }

        return $entities;
    }
760472
public function getPage($pageName, $pageType = PageTypes::NORMAL)
    {
        if ($this->pages->count() < 1) {
            return null;
        }

        /** @var \Rcm\Entity\Page $page */
        foreach ($this->pages as $page) {
            if ($page->getName() == $pageName
                && $page->getPageType() == $pageType
            ) {
                return $page;
            }
        }

        return null;
    }
210640
public function dumpIdentityMap(EntityManagerInterface $em)
    {
        $uow         = $em->getUnitOfWork();
        $identityMap = $uow->getIdentityMap();

        $fh = fopen($this->file, 'xb+');

        if (count($identityMap) === 0) {
            fwrite($fh, 'Flush Operation [' . $this->context . "] - Empty identity map.\n");

            return;
        }

        fwrite($fh, 'Flush Operation [' . $this->context . "] - Dumping identity map:\n");

        foreach ($identityMap as $className => $map) {
            fwrite($fh, 'Class: ' . $className . "\n");

            foreach ($map as $entity) {
                fwrite($fh, ' Entity: ' . $this->getIdString($entity, $uow) . ' ' . spl_object_id($entity) . "\n");
                fwrite($fh, "  Associations:\n");

                $cm = $em->getClassMetadata($className);

                foreach ($cm->getDeclaredPropertiesIterator() as $field => $association) {
                    if (! ($association instanceof AssociationMetadata)) {
                        continue;
                    }

                    fwrite($fh, '   ' . $field . ' ');

                    $value = $association->getValue($entity);

                    if ($value === null) {
                        fwrite($fh, " NULL\n");

                        continue;
                    }

                    if ($association instanceof ToOneAssociationMetadata) {
                        if ($value instanceof GhostObjectInterface && ! $value->isProxyInitialized()) {
                            fwrite($fh, '[PROXY] ');
                        }

                        fwrite($fh, $this->getIdString($value, $uow) . ' ' . spl_object_id($value) . "\n");
                    } else {
                        $initialized = ! ($value instanceof PersistentCollection) || $value->isInitialized();

                        if ($initialized) {
                            fwrite($fh, '[INITIALIZED] ' . $this->getType($value) . ' ' . count($value) . " elements\n");

                            foreach ($value as $obj) {
                                fwrite($fh, '    ' . $this->getIdString($obj, $uow) . ' ' . spl_object_id($obj) . "\n");
                            }
                        } else {
                            fwrite($fh, '[PROXY] ' . $this->getType($value) . " unknown element size\n");

                            foreach ($value->unwrap() as $obj) {
                                fwrite($fh, '    ' . $this->getIdString($obj, $uow) . ' ' . spl_object_id($obj) . "\n");
                            }
                        }
                    }
                }
            }
        }

        fclose($fh);
    }
18909
public function load(ObjectManager $manager)
    {
        $em = $this->container->get('doctrine.orm.entity_manager');

        $pageCreator = $this->container->get('kunstmaan_node.page_creator_service');

        $nodeRepo = $em->getRepository('KunstmaanNodeBundle:Node');
        $homePage = $nodeRepo->findOneBy(array('internalName' => 'homepage'));

        $sitemapPage = new SitemapPage();
        $sitemapPage->setTitle('Sitemap');

	$locales = explode('|', $this->container->getParameter('requiredlocales'));
        $translations = array();
	foreach ($locales as $locale) {
	    $translations[] = array('language' => $locale, 'callback' => function($page, $translation, $seo) {
		$translation->setTitle('Sitemap');
		$translation->setSlug('sitemap');
		$translation->setWeight(100);
	    });
	}

        $options = array(
            'parent' => $homePage,
            'page_internal_name' => 'sitemap',
            'set_online' => true,
            'hidden_from_nav' => true,
            'creator' => 'admin'
        );

        $pageCreator->createPage($sitemapPage, $translations, $options);
    }
574987
public function with($key, $value = null): PageInterface
    {
        $this->ui()->getView()->with($key, $value);

        return $this;
    }
893410
private function emptyTables(EntityManager $em)
    {
        $meta = $em->getClassMetadata('Alchemy\Phrasea\Model\Entities\User');
        $connection = $em->getConnection();
        $dbPlatform = $connection->getDatabasePlatform();

        if ($connection->getSchemaManager()->tablesExist([ $meta->getTableName() ])) {
            $connection->beginTransaction();

            try {
                $connection->query('SET FOREIGN_KEY_CHECKS=0');
                $connection->executeUpdate($dbPlatform->getTruncateTableSql($meta->getTableName()));
                $connection->query('SET FOREIGN_KEY_CHECKS=1');
                $connection->commit();
            } catch (\Exception $e) {
                $connection->rollback();
                throw $e;
            }
        }
    }
591724
public function load(ObjectManager $em) {
    foreach ($this->examples as $list) {
      list($example, $context) = $list;

      $fixture = new NestedSetFixture($example, $context);
      $fixture->load($em);
    }
  }
54345
protected function loadPage(
        string $entityClass,
        string $rel,
        string $uri
    ): PagedCollection {
        /** @var HalPagedResources $pagedResources */
        $pagedResources = $this->restClient->getResources(
                $entityClass,
                $rel,
                $uri
            );

        $mapClosure = function (HalResource $resource) {
            return $resource->getEntity();
        };
        $nextPage = function (string $uri) use ($entityClass, $rel) {
            return $this->loadPage($entityClass, $rel, $uri);
        };

        return new PagedCollection(
            $pagedResources->map($mapClosure),
            $pagedResources->getPageMetadata(),
            $pagedResources->getLinks(),
            $nextPage
        );
    }
218395
protected function wrapCommand($entityManagerName)
    {
        if (! $this->isVersionCompatible()) {
            throw new RuntimeException(sprintf('"%s" requires doctrine-orm "%s" or newer', $this->getName(), $this->getMinimalVersion()));
        }

        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $entityManagerName);
        $this->command->setApplication($this->getApplication());

        return $this->command;
    }
727859
public function setPage(\VFou\CmsBundle\Entity\Page $page = null)
    {
        $this->page = $page;

        return $this;
    }
106957
protected function createNewPage($entityType, $title = 'No title')
    {
        /* @var HasNodeInterface $newPage */
        $newPage = new $entityType();
        $newPage->setTitle($title);

        $this->em->persist($newPage);
        $this->em->flush();

        return $newPage;
    }
63960
public function buildViewReference(View $view, EntityManager $em = null)
    {
        $viewReferenceBuilder = $this->viewReferenceBuilderChain->getViewReferenceBuilder($view);
        $viewReference = $viewReferenceBuilder->buildReference($view, $em);

        return $viewReference;
    }
361314
public function open(array $params = array())
	{
		$url = $this->getAbsoluteUrl($params);

		if ( !$url ) {
			throw new PageException('Page url not specified', PageException::TYPE_EMPTY_URL);
		}

		$this->pageFactory->getSession()->visit($url);

		return $this;
	}
1339681
public function getCount(EntityManager $em, Request $request)
	{
		$stmt = $this->buildCountQuery($em, $request);
		$stmt->execute();
		return (int) $stmt->fetchColumn();
	}