PHP 클래스 Bolt\Legacy\Storage

사용 중단: Deprecated since 3.0, to be removed in 4.0.
파일 보기 프로젝트 열기: bolt/bolt 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$images array

공개 메소드들

메소드 설명
__construct ( Silex\Application $app )
deleteContent ( string $contenttype, integer $id ) : integer Delete a record.
depublishExpiredRecords ( )
getContent ( string $textquery, string $parameters = '', array &$pager = [], array $whereparameters = [] ) : array getContent based on a 'human readable query'.
getContentByTaxonomy ( string $taxonomyslug, string $name, string $parameters = [] ) : array Retrieve content from the database, filtered on taxonomy.
getContentObject ( array | string $contenttype, array $values = [] ) : Content Get an object for the content of a specific contenttype. This will be \Bolt\Legacy\Content, unless the contenttype defined another class to be used.
getContentType ( string $contenttypeslug ) : boolean | array Get the contenttype as an array, based on the given $contenttypeslug.
getContentTypeFieldType ( string $contenttypeslug, string $fieldname ) : array Get the fieldtype for a given contenttype and fieldname.
getContentTypeFields ( string $contenttypeslug ) : array Get an array of the available fields for a given contenttype.
getContentTypeGrouping ( string $contenttypeslug ) : mixed Check if a given contenttype has a grouping, and if it does, return it.
getContentTypeTaxonomy ( string $contenttypeslug ) : array Get an array of the available taxonomytypes for a given contenttype.
getContentTypes ( ) : array Get an array of the available contenttypes.
getContenttypeTablename ( string | array $contenttype ) : string Get the tablename with prefix from a given Contenttype.
getEmptyContent ( $contenttypeslug )
getLatestId ( $contenttypeslug )
getPager ( string $name = null ) : array Getter of a pager element. Pager can hold a paging snapshot map.
getRepeaters ( $content )
getSortOrder ( string $name = '-datepublish' ) : string Get sorting order of name, stripping possible " DESC" " ASC" etc., and also return the sorting order.
getTablename ( string $name ) : string Get the table name with prefix from a given $name.
getTaxonomyType ( string $taxonomyslug ) : boolean | array Get the taxonomy as an array, based on the given $taxonomyslug.
getUri ( string $title, integer $id, string $contenttypeslug = "", boolean $fulluri = true, boolean $allowempty = true, boolean $slugfield = 'slug' ) : string Get a unique URL for a record
isEmptyPager ( ) : boolean
preFill ( array $contenttypes = [] ) : string Add some records with dummy content.
publishTimedRecords ( )
saveContent ( Content $content, string $comment = null ) : integer Save a record.
searchAllContentTypes ( array $parameters = [], &$pager = [] )
searchContent ( string $q, array $contenttypes = null, array $filters = null, integer $limit = 9999, integer $offset ) : mixed Search through actual content.
searchContentType ( $contenttypename, array $parameters = [], &$pager = [] )
setPager ( string $name, array | Bolt\Pager $pager ) : Storage Setter for pager storage element.
updateSingleValue ( string $contenttype, integer $id, string $field, mixed $value ) : boolean Update a single value from content.

보호된 메소드들

메소드 설명
decodePageParameter ( string $context = '', array $inParameters = null ) : mixed Decodes contextual page number from current request url if found.
executeGetContentQueries ( array $decoded ) : array Execute the content queries.
executeGetContentSearch ( array $decoded, array $parameters ) : array Execute the content queries.
findContent ( string $tablename, integer $contentId ) : array Find record from Content Type and Content Id.
getOrderBys ( $order ) : array Get the ORDER BY parameters for the query.
getRelation ( array $content ) : array Get the relations for one or more units of content, return the array with the taxonomy attached.
getTaxonomy ( Content[] $content ) : array Get the taxonomy for one or more units of content, return the array with the taxonomy attached.
hasRecords ( $tablename )
insertContent ( Content $content, string $comment = null ) : boolean Insert a new contenttype record in the database.
isMultiOrderQuery ( $order ) : boolean Check if this query has multiple ORDER BY parameters.
isNotLastItemInArray ( $totalOrderByElements, $index ) : boolean Check if this is the last element in the array.
tableExists ( $name ) : boolean Check if the table $name exists. We use our own queries here, because it's _much_ faster than Doctrine's getSchemaManager().
updateRelation ( string $contenttype, integer $contentId, array $relation ) Update / insert relation for a given content-unit.
updateTaxonomy ( string $contenttype, integer $contentId, array $taxonomy ) Update / insert taxonomy for a given content-unit.

비공개 메소드들

메소드 설명
compareSearchWeights ( Content $a, Content $b ) : integer Compare by search weights.
decodeContentQuery ( string $textquery, array $inParameters = null ) : array Decode a content textquery
decodeContentTypesFromText ( string $text ) : array Decode a contenttypes argument from text.
decodeQueryOrder ( array $contenttype, string $orderValue ) : string Get the parameter for the 'order by' part of a query.
decodeSearchQuery ( $q ) Decode search query into searchable parts.
getBlocksTitle ( ) : string Get the title for a 'Block' contenttype. Check if the desired ones aren't present in the database yet, and return them in order.
getEscapedSortorder ( string $name, string $prefix = 'r' ) : string Get an escaped sortorder for use in SQL, from a fieldname like 'title' or '-id'.
getFieldName ( string $name ) : string Get field name, stripping possible " DESC" " ASC" etc.
getSomeRandomTags ( integer $num = 5 ) : string[] Get an array of random tags
getValidSaveData ( array $fieldvalues, array $contenttype ) : array Get a valid array to commit.
groupingSort ( Content $a, Content $b ) : integer Helper function for sorting Records of content that have a Grouping.
hydrateRows ( array | string $contenttype, array $rows, boolean $getTaxoAndRel = true ) : array Hydrate database rows into objects.
isValidColumn ( string $name, array $contenttype, boolean $allowVariants = false ) : boolean Check if a given name is a valid column, and if it can be used in queries.
logDelete ( string $contenttype, integer $contentid, array $content, string $comment = null ) Writes a content-changelog entry for a deleted entry.
logInsert ( string $contenttype, integer $contentid, array $content, string $comment = null ) Writes a content-changelog entry for a newly-created entry.
logUpdate ( string $contenttype, integer $contentid, array $newContent, array $oldContent = null, string $comment = null ) Writes a content-changelog entry for an updated entry.
organizeQueryParameters ( array | string | null $inParameters = null ) : array Split into meta-parameters and contenttype parameters.
parseTextQuery ( $textquery, array &$decoded, array &$metaParameters, array &$ctypeParameters ) Parse textquery into useable arguments.
parseWhereParameter ( string $key, string $value, mixed $fieldtype = false ) : string Helper function to set the proper 'where' parameter, when getting values like '<2012' or '!bob'.
preFillSingle ( string $key, array $contenttype, array $images ) : string Add a record with dummy content.
prepareDecodedQueryForUse ( &$decoded, &$metaParameters, &$ctypeParameters ) Prepare decoded for actual use.
runContentTypeTableChecks ( array $contenttypes ) : boolean Check for the existence of ContentType tables.
searchSingleContentType ( $query, $contenttype, $fields, array $filter = null, boolean $implode = false ) : Content Search through a single contenttype.
updateContent ( Content $content, string $comment = null ) : boolean Update a Bolt contenttype record.

메소드 상세

__construct() 공개 메소드

public __construct ( Silex\Application $app )
$app Silex\Application

decodePageParameter() 보호된 메소드

Decodes contextual page number from current request url if found.
사용 중단: Not used in core anymore
protected decodePageParameter ( string $context = '', array $inParameters = null ) : mixed
$context string Pager id/name in url which value we find
$inParameters array
리턴 mixed Page number in context

deleteContent() 공개 메소드

Delete a record.
public deleteContent ( string $contenttype, integer $id ) : integer
$contenttype string
$id integer
리턴 integer The number of affected rows.

depublishExpiredRecords() 공개 메소드

또한 보기: Bolt\Storage\EventProcessor\TimedRecord::holdExpiredRecords()
사용 중단: Deprecated since 3.0, to be removed in 4.0.

executeGetContentQueries() 보호된 메소드

This is tightly coupled to $this->getContent()
protected executeGetContentQueries ( array $decoded ) : array
$decoded array
리턴 array

executeGetContentSearch() 보호된 메소드

This is tightly coupled to $this->getContent()
protected executeGetContentSearch ( array $decoded, array $parameters ) : array
$decoded array
$parameters array
리턴 array

findContent() 보호된 메소드

Find record from Content Type and Content Id.
protected findContent ( string $tablename, integer $contentId ) : array
$tablename string Table name
$contentId integer Content Id
리턴 array

getContent() 공개 메소드

Used directly by {% setcontent %} but also in other parts. This code has been split into multiple methods in the spirit of separation of concerns, but the situation is still far from ideal. Where applicable each 'concern' notes the coupling in the local documentation.
public getContent ( string $textquery, string $parameters = '', array &$pager = [], array $whereparameters = [] ) : array
$textquery string
$parameters string
$pager array
$whereparameters array
리턴 array

getContentByTaxonomy() 공개 메소드

Note: we can NOT sort on anything meaningful. Records are fetched from multiple content-types, so we can not do joins. Neither can we sort after fetching, because it would mean fetching _all_ records and _then_ doing the sorting. Instead, we do not sort here. If you need ordering, use the '|order()' in your templates.
public getContentByTaxonomy ( string $taxonomyslug, string $name, string $parameters = [] ) : array
$taxonomyslug string
$name string
$parameters string
리턴 array

getContentObject() 공개 메소드

Get an object for the content of a specific contenttype. This will be \Bolt\Legacy\Content, unless the contenttype defined another class to be used.
public getContentObject ( array | string $contenttype, array $values = [] ) : Content
$contenttype array | string
$values array
리턴 Content

getContentType() 공개 메소드

Get the contenttype as an array, based on the given $contenttypeslug.
public getContentType ( string $contenttypeslug ) : boolean | array
$contenttypeslug string
리턴 boolean | array

getContentTypeFieldType() 공개 메소드

Get the fieldtype for a given contenttype and fieldname.
public getContentTypeFieldType ( string $contenttypeslug, string $fieldname ) : array
$contenttypeslug string
$fieldname string
리턴 array $fields

getContentTypeFields() 공개 메소드

Get an array of the available fields for a given contenttype.
public getContentTypeFields ( string $contenttypeslug ) : array
$contenttypeslug string
리턴 array $fields

getContentTypeGrouping() 공개 메소드

Check if a given contenttype has a grouping, and if it does, return it.
public getContentTypeGrouping ( string $contenttypeslug ) : mixed
$contenttypeslug string
리턴 mixed $grouping

getContentTypeTaxonomy() 공개 메소드

Get an array of the available taxonomytypes for a given contenttype.
public getContentTypeTaxonomy ( string $contenttypeslug ) : array
$contenttypeslug string
리턴 array $taxonomy

getContentTypes() 공개 메소드

Get an array of the available contenttypes.
public getContentTypes ( ) : array
리턴 array $contenttypes

getContenttypeTablename() 공개 메소드

Get the tablename with prefix from a given Contenttype.
public getContenttypeTablename ( string | array $contenttype ) : string
$contenttype string | array
리턴 string

getEmptyContent() 공개 메소드

public getEmptyContent ( $contenttypeslug )

getLatestId() 공개 메소드

public getLatestId ( $contenttypeslug )

getOrderBys() 보호된 메소드

Get the ORDER BY parameters for the query.
protected getOrderBys ( $order ) : array
$order
리턴 array

getPager() 공개 메소드

Getter of a pager element. Pager can hold a paging snapshot map.
사용 중단: Just for keep BC
public getPager ( string $name = null ) : array
$name string Optional name of a pager element. Whole pager map returns if no name given.
리턴 array

getRelation() 보호된 메소드

Get the relations for one or more units of content, return the array with the taxonomy attached.
protected getRelation ( array $content ) : array
$content array
리턴 array $content

getRepeaters() 공개 메소드

public getRepeaters ( $content )

getSortOrder() 공개 메소드

Get sorting order of name, stripping possible " DESC" " ASC" etc., and also return the sorting order.
public getSortOrder ( string $name = '-datepublish' ) : string
$name string
리턴 string

getTablename() 공개 메소드

Get the table name with prefix from a given $name.
public getTablename ( string $name ) : string
$name string
리턴 string

getTaxonomy() 보호된 메소드

Get the taxonomy for one or more units of content, return the array with the taxonomy attached.
protected getTaxonomy ( Content[] $content ) : array
$content Content[]
리턴 array $content

getTaxonomyType() 공개 메소드

Get the taxonomy as an array, based on the given $taxonomyslug.
public getTaxonomyType ( string $taxonomyslug ) : boolean | array
$taxonomyslug string
리턴 boolean | array

getUri() 공개 메소드

Get a unique URL for a record
public getUri ( string $title, integer $id, string $contenttypeslug = "", boolean $fulluri = true, boolean $allowempty = true, boolean $slugfield = 'slug' ) : string
$title string
$id integer
$contenttypeslug string
$fulluri boolean
$allowempty boolean
$slugfield boolean
리턴 string

hasRecords() 보호된 메소드

protected hasRecords ( $tablename )

insertContent() 보호된 메소드

Insert a new contenttype record in the database.
protected insertContent ( Content $content, string $comment = null ) : boolean
$content Content Record content to insert
$comment string Editor's comment
리턴 boolean

isEmptyPager() 공개 메소드

public isEmptyPager ( ) : boolean
리턴 boolean

isMultiOrderQuery() 보호된 메소드

Check if this query has multiple ORDER BY parameters.
protected isMultiOrderQuery ( $order ) : boolean
$order
리턴 boolean

isNotLastItemInArray() 보호된 메소드

Check if this is the last element in the array.
protected isNotLastItemInArray ( $totalOrderByElements, $index ) : boolean
$totalOrderByElements
$index
리턴 boolean

preFill() 공개 메소드

Only fill the contenttypes passed as parameters If the parameters is empty, only fill empty tables
또한 보기: preFillSingle
public preFill ( array $contenttypes = [] ) : string
$contenttypes array
리턴 string

publishTimedRecords() 공개 메소드

또한 보기: Bolt\Storage\EventProcessor\TimedRecord::publishTimedRecords()
사용 중단: Deprecated since 3.0, to be removed in 4.0.
public publishTimedRecords ( )

saveContent() 공개 메소드

Save a record.
public saveContent ( Content $content, string $comment = null ) : integer
$content Content
$comment string
리턴 integer

searchAllContentTypes() 공개 메소드

public searchAllContentTypes ( array $parameters = [], &$pager = [] )
$parameters array

searchContent() 공개 메소드

Unless the query is invalid it will always return a 'result array'. It may complain in the log but it won't abort.
public searchContent ( string $q, array $contenttypes = null, array $filters = null, integer $limit = 9999, integer $offset ) : mixed
$q string Search string
$contenttypes array Contenttype names to search for: - string: Specific contenttype - null: Every searchable contenttype
$filters array Additional filters for contenttypes - key is contenttype - value is filter
$limit integer limit the number of results
$offset integer skip this number of results
리턴 mixed false if query is invalid, an array with results if query was executed

searchContentType() 공개 메소드

public searchContentType ( $contenttypename, array $parameters = [], &$pager = [] )
$parameters array

setPager() 공개 메소드

Setter for pager storage element.
사용 중단: Just for keep BC
public setPager ( string $name, array | Bolt\Pager $pager ) : Storage
$name string
$pager array | Bolt\Pager
리턴 Storage

tableExists() 보호된 메소드

Check if the table $name exists. We use our own queries here, because it's _much_ faster than Doctrine's getSchemaManager().
protected tableExists ( $name ) : boolean
$name
리턴 boolean

updateRelation() 보호된 메소드

$relation looks like: arr(2) [ "pages" => arr(1) [ 0 => str(2) "22" ] "showcases" => arr(3) [ 0 => str(2) "15" 1 => str(1) "9" 2 => str(2) "13" ] ] $currentvalues looks like arr(2) [ 0 => arr(3) [ "id" => str(1) "5" "to_contenttype" => str(12) "showcases" "to_id" => str(2) "15" ] 1 => arr(3) [ "id" => str(1) "6" "to_contenttype" => str(12) "showcases" "to_id" => str(1) "9" ] ]
protected updateRelation ( string $contenttype, integer $contentId, array $relation )
$contenttype string
$contentId integer
$relation array

updateSingleValue() 공개 메소드

It is called in list of contents.
public updateSingleValue ( string $contenttype, integer $id, string $field, mixed $value ) : boolean
$contenttype string Content Type to be edited.
$id integer Id of content to be updated.
$field string Field name of content to be changed.
$value mixed New value to be defined on field.
리턴 boolean Returns true when update is done or false if not.

updateTaxonomy() 보호된 메소드

Update / insert taxonomy for a given content-unit.
protected updateTaxonomy ( string $contenttype, integer $contentId, array $taxonomy )
$contenttype string
$contentId integer
$taxonomy array

프로퍼티 상세

$images 공개적으로 프로퍼티

public array $images
리턴 array