Documentation

PageRepository extends EntityRepository

PageRepository

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

CLOUDREXX Development Team info@cloudrexx.com

subpackage

core_contentmanager

Table of Contents

Constants

DataProperty  = '__data'
SEARCH_MODE_ALIAS_ONLY  = 2
SEARCH_MODE_ALL  = 3
SEARCH_MODE_PAGES_ONLY  = 1

Properties

$em  : mixed
$virtualPages  : mixed

Methods

__construct()  : mixed
addVirtualPage()  : mixed
Adds a virtual page to the page repository.
createPage()  : Page
Creates a page with the given parameters.
existsModuleCmd()  : bool
Returns true if the page selected by its language, module name (section) and optional cmd parameters exists
find()  : mixed
findAll()  : array<string|int, mixed>
Finds all entities in the repository.
findBy()  : array<string|int, mixed>
Finds entities by a set of criteria.
findOneBy()  : object
Finds a single entity by a set of criteria.
findOneByModuleCmdLang()  : Page
Find a single page specified by module, cmd and lang.
getAllFromModuleCmdByLang()  : array<string|int, mixed>
Returns all pages sorted by their language id for the specified module and cmd.
getFromModuleCmdByLang()  : array<string|int, mixed>
An array of pages sorted by their langID for specified module and cmd.
getLastModifiedPages()  : mixed
getPagesAtPath()  : array<string|int, mixed>
Return Pages matching the given path
getPagesPointingTo()  : array<string|int, mixed>
Generates a list of pages pointing to $page
getPageTranslations()  : mixed
Returns an array with the page translations of the given page id.
getPath()  : string
Get a pages' path. Alias for $page->getPath() for compatibility reasons For compatibility reasons, this path won't start with a slash!
getTargetPage()  : mixed
Returns the target page for a page with internal target
getTypeByPage()  : string
Returns the type of the page as string.
resolve()  : array<string|int, mixed>
Return the Page matching the given Path and mode
searchResultsForSearchModule()  : array<string|int, mixed>
Searches the content and returns an array that is built as needed by the search module.
lookupPageFromModuleAndCmdByFallbackLanguage()  : null|Page
Tries to find a page that acts as a module page, but that does physically not exist in the specified language, but might exist as a fallback page.

Constants

Properties

Methods

__construct()

public __construct(EntityManager $em, ClassMetadata $class) : mixed
Parameters
$em : EntityManager
$class : ClassMetadata

addVirtualPage()

Adds a virtual page to the page repository.

public addVirtualPage(Page $virtualPage[, string $beforeSlug = '' ]) : mixed
Parameters
$virtualPage : Page
$beforeSlug : string = ''
Tags
todo

Remembering virtual pages is no longer necessary, rewrite method to create new virtual pages

createPage()

Creates a page with the given parameters.

public createPage(Node $parentNode, int $lang, string $title, string $type, string $module, string $cmd, bool $display, string $content) : Page

This should be a constructor of Page. Since PHP does not support method overloading and doctrine needs a constructor without parameters, it's located here.

Parameters
$parentNode : Node
$lang : int

Language id

$title : string

Page title

$type : string

Page type (fallback, content, application)

$module : string

Module name

$cmd : string

Module cmd

$display : bool

Is page shown in navigation?

$content : string

HTML content

Return values
Page

Newly created page

existsModuleCmd()

Returns true if the page selected by its language, module name (section) and optional cmd parameters exists

public existsModuleCmd(int $lang, string $module[, string $cmd = null ]) : bool
Parameters
$lang : int

The language ID

$module : string

The module (aka section) name

$cmd : string = null

The optional cmd parameter value

Tags
author

Reto Kohli reto.kohli@comvation.com

since
3.0.0
internal

Required by the Shop module

Return values
bool

True if the page exists, false otherwise

find()

public find(mixed $id[, mixed $lockMode = 0 ][, mixed $lockVersion = NULL ][, mixed $useResultCache = true ]) : mixed
Parameters
$id : mixed
$lockMode : mixed = 0
$lockVersion : mixed = NULL
$useResultCache : mixed = true

findAll()

Finds all entities in the repository.

public findAll() : array<string|int, mixed>
Return values
array<string|int, mixed>

The entities.

findBy()

Finds entities by a set of criteria.

public findBy(array<string|int, mixed> $criteria[, array<string|int, mixed> $orderBy = null ][, mixed $limit = null ][, mixed $offset = null ][, bool $inactive_langs = false ]) : array<string|int, mixed>
Parameters
$criteria : array<string|int, mixed>
$orderBy : array<string|int, mixed> = null
$limit : mixed = null
$offset : mixed = null
$inactive_langs : bool = false
Tags
override
Return values
array<string|int, mixed>

findOneBy()

Finds a single entity by a set of criteria.

public findOneBy(array<string|int, mixed> $criteria[, bool $inactive_langs = false ][, mixed $useResultCache = true ]) : object

If $criteria is just set to ['id' => 0] and the current request is a preview page request from Content Manager, then the preview page will be returned. The preview page gets initialized by the Resolver and is fetch using Resolver::getPreviewPage().

Parameters
$criteria : array<string|int, mixed>
$inactive_langs : bool = false
$useResultCache : mixed = true
Tags
override
Return values
object

findOneByModuleCmdLang()

Find a single page specified by module, cmd and lang.

public findOneByModuleCmdLang(string $module, string $cmd, int $lang) : Page

Use to find a specific module page within a certain language.

Parameters
$module : string

Module name

$cmd : string

Cmd of the module

$lang : int

Language-Id

Tags
todo

Instead of casting $cmd to string here, we must ensure that all method-calls do properly pass $cmd as string.

Return values
Page

getAllFromModuleCmdByLang()

Returns all pages sorted by their language id for the specified module and cmd.

public getAllFromModuleCmdByLang(string $module[, string $cmd = null ]) : array<string|int, mixed>
Parameters
$module : string
$cmd : string = null

Optional:

  • If cmd is a string all pages with the given module and cmd are returned.
  • If cmd is an empty string all pages of the given module having an empty cmd are returned.
  • If cmd is null all pages of the given module are returned (regardless of their cmd).
Return values
array<string|int, mixed>

( langId => array( Pages ) )

getFromModuleCmdByLang()

An array of pages sorted by their langID for specified module and cmd.

public getFromModuleCmdByLang(string $module[, string $cmd = null ]) : array<string|int, mixed>
Parameters
$module : string
$cmd : string = null

optional

Return values
array<string|int, mixed>

( langId => Page )

getLastModifiedPages()

public getLastModifiedPages(mixed $from, mixed $count) : mixed
Parameters
$from : mixed
$count : mixed

getPagesAtPath()

Return Pages matching the given path

public getPagesAtPath(string $path[, int $lang = null ][, int $search_mode = self::SEARCH_MODE_PAGES_ONLY ]) : array<string|int, mixed>

The returned array has the form, [ matchedPath => 'Hello/APage/', unmatchedPath => 'AModuleObject' node => Node, lang => [matching language IDs], page => [matching pages], ]

Parameters
$path : string

E.g., 'Hello/APage/AModuleObject'

$lang : int = null
$search_mode : int = self::SEARCH_MODE_PAGES_ONLY

One of the SEARCH_MODE_* values

Return values
array<string|int, mixed>

getPagesPointingTo()

Generates a list of pages pointing to $page

public getPagesPointingTo(Page $page[, array<string|int, mixed> &$subPages = array() ]) : array<string|int, mixed>
Parameters
$page : Page

Page to get referencing pages for

$subPages : array<string|int, mixed> = array()

(optional, by reference) Do not use, internal

Return values
array<string|int, mixed>

List of pages (ID as key, page object as value)

getPageTranslations()

Returns an array with the page translations of the given page id.

public getPageTranslations(int $pageId, int $historyId) : mixed
Parameters
$pageId : int
$historyId : int

If the page does not exist, we need the history id to revert them.

getPath()

Get a pages' path. Alias for $page->getPath() for compatibility reasons For compatibility reasons, this path won't start with a slash!

public getPath(Page $page) : string
Parameters
$page : Page
Tags
todo

remove this method

Return values
string

path, e.g. 'This/Is/It'

getTargetPage()

Returns the target page for a page with internal target

public getTargetPage(Page $page) : mixed
Parameters
$page : Page
Tags
todo

use this everywhere (resolver!)

getTypeByPage()

Returns the type of the page as string.

public getTypeByPage(Page $page) : string
Parameters
$page : Page
Return values
string

$type

resolve()

Return the Page matching the given Path and mode

public resolve(string $path, int $search_mode) : array<string|int, mixed>

The returned array has the form, [ 'matchedPath' => 'path/with/trailing/slash/', 'unmatchedPath' => 'not/matched', 'treePointer' => [ '__data' => [ 'lang' => [language ID], 'page' => Page, 'node' => Node, ] ] ]

Parameters
$path : string

E.g., 'Hello/APage/AModuleObject'

$search_mode : int

One of the SEARCH_MODE_* values

Return values
array<string|int, mixed>

searchResultsForSearchModule()

Searches the content and returns an array that is built as needed by the search module.

public searchResultsForSearchModule(Search $search, mixed $license) : array<string|int, mixed>

Please do not use this anywhere else, write a search method with proper results instead. Ideally, this method would then be invoked by searchResultsForSearchModule().

Parameters
$search : Search
$license : mixed
Return values
array<string|int, mixed>

( 'Score' => int 'Title' => string 'Content' => string 'Link' => string )

lookupPageFromModuleAndCmdByFallbackLanguage()

Tries to find a page that acts as a module page, but that does physically not exist in the specified language, but might exist as a fallback page.

private lookupPageFromModuleAndCmdByFallbackLanguage(string $module, string $cmd, int $lang) : null|Page
Parameters
$module : string
$cmd : string
$lang : int
Return values
null|Page

returns the page object or null


        
On this page

Search results