PHP Класс Devise\Pages\PageManager

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$errors array Errors are kept in an array and can be used later if validation fails and we want to know why
$message string This is a message that we can store why the validation failed
$warnings [type] [$warnings description]

Защищенные свойства (Protected)

Свойство Тип Описание
$FieldManager Devise\Pages\Fields\FieldManager FieldManager lets us manage the fields
$FieldsRepository Devise\Pages\Fields\FieldsRepository FieldsRepository returns information about fields
$Page Page DvsPage model to fetch database dvs_pages
$PageFields array ..
$PageVersionManager PageVersionManager PageVersionManager lets us manage versions of a page
$Validator Illuminate\Validation\Factory Validator is used to validate page rules

Открытые методы

Метод Описание
__construct ( DvsPage $Page, PageVersionManager $PageVersionManager, PageVersionsRepository $PageVersionsRepository, FieldsRepository $FieldsRepository, FieldManager $FieldManager, Framework $Framework, RoutesGenerator $RoutesGenerator, DvsLanguage $Language ) Construct a new page manager
copyPage ( integer $fromPageId, array $input ) : DvsPage Takes the input provided and runs the create method after stripping necessary fields.
createNewPage ( $input ) : boolean Validates and creates a page with the given input
destroyPage ( integer $id ) : boolean Destroys a page
markContentRequestedFieldsComplete ( $pageId ) : string Marks all page's fields with a "true" content_requested value as complete
toggleABTesting ( [type] $pageId, [type] $isEnabled ) : [type] [toggleABTesting description]
updatePage ( integer $id, array $input ) : boolean Validates and updates a page with the given input
updatePageVersionABTestingAmount ( [type] $pageVersionId, [type] $amount ) : [type] [updatePageVersionABTestingAmount description]
updatePageVersionDates ( integer $pageVersionId, array $input ) : void Updates the page version dates
updatePageVersionView ( [type] $pageVersionId, [type] $view ) : [type] Updates the page version view

Защищенные методы

Метод Описание
cacheDeviseRoutes ( ) : [type] Cache the devise routes, and make sure to catch an exception. Exception thrown is likely due to serialization error caused by caching routes with closures in them
createPageFromInput ( array $input ) : DvsPage Creates a page from the given input data
findAvailableRoute ( string $suggestedRoute, $languageId ) : string This helper method keeps looking through suggested route names and adding a number onto the suggested route until it finds an available one that isn't taken in the database. We don't want route names to be the same ever as they should be unique so this helps us accomplish that.
isValidInputForNewPage ( [type] $input ) : boolean [isValidInputForNewPage description]
setTranslatedFromPageId ( $fromPage, array &$input ) : array This ensures that we are translating from the correct "parent" page.
setTranslatedFromRouteName ( $fromPage, array &$input ) Sets the route_name equal to the orignal page's route_name

Описание методов

__construct() публичный Метод

Construct a new page manager
public __construct ( DvsPage $Page, PageVersionManager $PageVersionManager, PageVersionsRepository $PageVersionsRepository, FieldsRepository $FieldsRepository, FieldManager $FieldManager, Framework $Framework, RoutesGenerator $RoutesGenerator, DvsLanguage $Language )
$Page DvsPage
$PageVersionManager PageVersionManager
$PageVersionsRepository PageVersionsRepository
$FieldsRepository Devise\Pages\Fields\FieldsRepository
$FieldManager Devise\Pages\Fields\FieldManager
$Framework Devise\Support\Framework
$RoutesGenerator RoutesGenerator
$Language DvsLanguage

cacheDeviseRoutes() защищенный Метод

Cache the devise routes, and make sure to catch an exception. Exception thrown is likely due to serialization error caused by caching routes with closures in them
protected cacheDeviseRoutes ( ) : [type]
Результат [type]

copyPage() публичный Метод

Takes the input provided and runs the create method after stripping necessary fields.
public copyPage ( integer $fromPageId, array $input ) : DvsPage
$fromPageId integer
$input array
Результат DvsPage

createNewPage() публичный Метод

Validates and creates a page with the given input
public createNewPage ( $input ) : boolean
Результат boolean

createPageFromInput() защищенный Метод

Creates a page from the given input data
protected createPageFromInput ( array $input ) : DvsPage
$input array
Результат DvsPage

destroyPage() публичный Метод

Destroys a page
public destroyPage ( integer $id ) : boolean
$id integer
Результат boolean

findAvailableRoute() защищенный Метод

This helper method keeps looking through suggested route names and adding a number onto the suggested route until it finds an available one that isn't taken in the database. We don't want route names to be the same ever as they should be unique so this helps us accomplish that.
protected findAvailableRoute ( string $suggestedRoute, $languageId ) : string
$suggestedRoute string
Результат string

isValidInputForNewPage() защищенный Метод

[isValidInputForNewPage description]
protected isValidInputForNewPage ( [type] $input ) : boolean
$input [type]
Результат boolean

markContentRequestedFieldsComplete() публичный Метод

Marks all page's fields with a "true" content_requested value as complete
public markContentRequestedFieldsComplete ( $pageId ) : string
Результат string

setTranslatedFromPageId() защищенный Метод

This happens when a user creates a page and then copies that "parent" page to a "child" page. When the user tries to copy the "child" page to a "grandchild" page. We want the "grandchild" to be a "child" instead of a "grandchild". This keeps page nesting down to 1 level instead of nesting under many levels.
protected setTranslatedFromPageId ( $fromPage, array &$input ) : array
$input array
Результат array

setTranslatedFromRouteName() защищенный Метод

Sets the route_name equal to the orignal page's route_name
protected setTranslatedFromRouteName ( $fromPage, array &$input )
$input array

toggleABTesting() публичный Метод

[toggleABTesting description]
public toggleABTesting ( [type] $pageId, [type] $isEnabled ) : [type]
$pageId [type]
$isEnabled [type]
Результат [type]

updatePage() публичный Метод

Validates and updates a page with the given input
public updatePage ( integer $id, array $input ) : boolean
$id integer
$input array
Результат boolean

updatePageVersionABTestingAmount() публичный Метод

[updatePageVersionABTestingAmount description]
public updatePageVersionABTestingAmount ( [type] $pageVersionId, [type] $amount ) : [type]
$pageVersionId [type]
$amount [type]
Результат [type]

updatePageVersionDates() публичный Метод

Updates the page version dates
public updatePageVersionDates ( integer $pageVersionId, array $input ) : void
$pageVersionId integer
$input array
Результат void

updatePageVersionView() публичный Метод

Updates the page version view
public updatePageVersionView ( [type] $pageVersionId, [type] $view ) : [type]
$pageVersionId [type]
$view [type]
Результат [type]

Описание свойств

$FieldManager защищенное свойство

FieldManager lets us manage the fields
protected FieldManager,Devise\Pages\Fields $FieldManager
Результат Devise\Pages\Fields\FieldManager

$FieldsRepository защищенное свойство

FieldsRepository returns information about fields
protected FieldsRepository,Devise\Pages\Fields $FieldsRepository
Результат Devise\Pages\Fields\FieldsRepository

$Page защищенное свойство

DvsPage model to fetch database dvs_pages
protected Page $Page
Результат Page

$PageFields защищенное статическое свойство

..
protected static array $PageFields
Результат array

$PageVersionManager защищенное свойство

PageVersionManager lets us manage versions of a page
protected PageVersionManager,Devise\Pages $PageVersionManager
Результат PageVersionManager

$Validator защищенное свойство

Validator is used to validate page rules
protected Illuminate\Validation\Factory $Validator
Результат Illuminate\Validation\Factory

$errors публичное свойство

Errors are kept in an array and can be used later if validation fails and we want to know why
public array $errors
Результат array

$message публичное свойство

This is a message that we can store why the validation failed
public string $message
Результат string

$warnings публичное свойство

[$warnings description]
public [type] $warnings
Результат [type]