idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
39,100
private function createLoadContentInfoQueryBuilder ( bool $ joinMainLocation = true ) : DoctrineQueryBuilder { $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ expr = $ queryBuilder -> expr ( ) ; $ joinCondition = $ expr -> eq ( 'c.id' , 't.contentobject_id' ) ; if ( $ joinMainLocation ) { $ joinCond...
Get query builder to load Content Info data .
39,101
public function loadContentInfoByRemoteId ( $ remoteId ) { $ queryBuilder = $ this -> createLoadContentInfoQueryBuilder ( ) ; $ queryBuilder -> where ( 'c.remote_id = :id' ) -> setParameter ( 'id' , $ remoteId , ParameterType :: STRING ) ; $ results = $ queryBuilder -> execute ( ) -> fetchAll ( FetchMode :: ASSOCIATIVE...
Loads info for a content object identified by its remote ID .
39,102
private function getLanguageQuery ( ) { $ languageQuery = $ this -> dbHandler -> createSelectQuery ( ) ; $ languageQuery -> select ( $ languageQuery -> expr -> searchedCase ( [ $ languageQuery -> expr -> lAnd ( $ languageQuery -> expr -> eq ( $ this -> dbHandler -> quoteColumn ( 'initial_language_id' ) , ':languageId' ...
Returns a language sub select query for setName .
39,103
public function deleteTranslationFromContent ( $ contentId , $ languageCode ) { $ language = $ this -> languageHandler -> loadByLanguageCode ( $ languageCode ) ; $ this -> connection -> beginTransaction ( ) ; try { $ this -> deleteTranslationFromContentVersions ( $ contentId , $ language -> id ) ; $ this -> deleteTrans...
Remove the specified translation from the Content Object Version .
39,104
private function deleteTranslationFromContentObject ( $ contentId , $ languageId ) { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ezcontentobject' ) -> set ( 'language_mask' , 'language_mask & ~ ' . $ languageId ) -> set ( 'modified' , ':now' ) -> where ( 'id = :contentId' ) -> andWhe...
Remove language from language_mask of ezcontentobject .
39,105
private function deleteTranslationFromContentVersions ( $ contentId , $ languageId , $ versionNo = null ) { $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( 'ezcontentobject_version' ) -> set ( 'language_mask' , 'language_mask & ~ ' . $ languageId ) -> set ( 'modified' , ':now' ) -> set ( ...
Remove language from language_mask of ezcontentobject_version and update initialLanguageId if it matches the removed one .
39,106
public function get ( $ parameterName , $ defaultValue = null , $ deep = false ) { return $ this -> params -> get ( $ parameterName , $ defaultValue , $ deep ) ; }
Returns a route parameter .
39,107
protected function loadObject ( ) { $ this -> object = $ this -> generator -> send ( $ this -> id ) ; $ this -> generator -> next ( ) ; unset ( $ this -> generator ) ; }
Loads the generator to object value and unset s generator .
39,108
protected function fetchUserGroups ( $ userId ) { $ query = $ this -> handler -> createSelectQuery ( ) ; $ query -> select ( $ this -> handler -> quoteColumn ( 'path_string' , 'ezcontentobject_tree' ) ) -> from ( $ this -> handler -> quoteTable ( 'ezcontentobject_tree' ) ) -> where ( $ query -> expr -> eq ( $ this -> h...
Fetch all group IDs the user belongs to .
39,109
public function removePolicyLimitations ( $ policyId ) { $ query = $ this -> handler -> createSelectQuery ( ) ; $ query -> select ( $ this -> handler -> aliasedColumn ( $ query , 'id' , 'ezpolicy_limitation' ) , $ this -> handler -> aliasedColumn ( $ query , 'id' , 'ezpolicy_limitation_value' ) ) -> from ( $ this -> ha...
Remove all limitations for a policy .
39,110
public function generateScopeBaseNode ( ArrayNodeDefinition $ rootNode , $ scopeNodeName = 'system' ) { $ contextNode = $ rootNode -> children ( ) -> arrayNode ( $ scopeNodeName ) -> info ( 'System configuration. First key is always a siteaccess or siteaccess group name' ) -> example ( array ( 'my_siteaccess' => array ...
Generates the context node under which context based configuration will be defined .
39,111
public function createSearchIndex ( OutputInterface $ output , $ iterationCount , $ commit ) { $ output -> writeln ( 'Creating Elasticsearch Search Engine Index...' ) ; if ( ! $ this -> searchHandler instanceof SearchHandler ) { throw new RuntimeException ( sprintf ( 'Expected to find an instance of %s, but found %s' ,...
Create search engine index .
39,112
private function indexLocations ( $ contentId , ProgressBar $ progress ) { $ locationIds = $ this -> getContentLocationIds ( $ contentId ) ; foreach ( $ locationIds as $ locationId ) { try { $ location = $ this -> persistenceHandler -> locationHandler ( ) -> load ( $ locationId ) ; $ this -> searchHandler -> indexLocat...
Index Locations of the given Content Object .
39,113
public function setAutoLastModified ( ) { $ this -> setLastModified ( DateTime :: createFromFormat ( 'U' , $ this -> file -> mtime -> getTimestamp ( ) ) ) ; return $ this ; }
Automatically sets the Last - Modified header according the file modification date .
39,114
protected function getFieldsInformation ( $ fieldIdentifier ) { $ fieldMapArray = array ( ) ; $ fieldMap = $ this -> contentTypeHandler -> getSearchableFieldMap ( ) ; foreach ( $ fieldMap as $ contentTypeIdentifier => $ fieldIdentifierMap ) { if ( ! isset ( $ fieldIdentifierMap [ $ fieldIdentifier ] ) ) { continue ; } ...
Returns relevant field information for the specified field .
39,115
protected function loadContentTypeByIdentifier ( $ identifier , $ throwIfNotFound = true ) { $ contentType = null ; try { $ contentType = $ this -> contentTypeService -> loadContentTypeByIdentifier ( $ identifier ) ; } catch ( ApiExceptions \ NotFoundException $ e ) { $ notFoundException = $ e ; } if ( ! $ contentType ...
Load and return a content type by its identifier .
39,116
public function getFieldType ( $ identifier ) { if ( ! isset ( $ this -> fieldTypes [ $ identifier ] ) ) { throw new FieldTypeNotFoundException ( $ identifier ) ; } if ( $ this -> fieldTypes [ $ identifier ] instanceof SPIFieldType ) { return $ this -> fieldTypes [ $ identifier ] ; } elseif ( is_callable ( $ this -> fi...
Return a SPI FieldType object .
39,117
protected function setRestBodyType ( $ type ) { $ type = strtolower ( $ type ) ; switch ( $ type ) { case 'json' : case 'xml' : $ this -> restBodyType = $ type ; break ; default : throw new \ Exception ( "REST body type '$type' not suported" ) ; } }
Set body type of requests and responses .
39,118
protected function getResponseError ( $ property ) { $ exception = $ this -> getResponseObject ( ) ; if ( ! $ exception instanceof \ Exception ) { throw new InvalidArgumentException ( 'response object' , 'is not an exception' ) ; } switch ( $ property ) { case 'code' : return $ exception -> getCode ( ) ; case 'descript...
Get property from the returned Exception .
39,119
protected function convertObjectTo ( ValueObject $ object , $ type ) { $ type = strtolower ( $ type ) ; switch ( $ type ) { case 'json' : case 'xml' : $ visitor = $ this -> getKernel ( ) -> getContainer ( ) -> get ( 'ezpublish_rest.output.visitor.' . $ type ) ; break ; default : throw new InvalidArgumentException ( 're...
Convert an object to a request .
39,120
protected function createRequestObject ( $ objectType ) { $ repository = $ this -> getRepository ( ) ; switch ( $ objectType ) { case 'SessionInput' : $ this -> requestObject = new SessionInput ( ) ; break ; case 'ContentTypeGroupCreateStruct' : $ this -> requestObject = $ repository -> getContentTypeService ( ) -> new...
Create an object of the specified type .
39,121
public function dispatch ( DOMDocument $ document ) { $ documentNamespace = $ document -> documentElement -> lookupNamespaceURI ( null ) ; if ( $ documentNamespace === null ) { $ documentNamespace = $ document -> documentElement -> lookupNamespaceURI ( 'xhtml' ) ; } foreach ( $ this -> mapping as $ namespace => $ valid...
Dispatches DOMDocument to the namespace mapped validator .
39,122
public static function toUTF8Character ( $ charCode ) { switch ( $ charCode ) { case 0 : $ char = chr ( 0 ) ; break ; case ! ( $ charCode & 0xffffff80 ) : $ char = chr ( $ charCode ) ; break ; case ! ( $ charCode & 0xfffff800 ) : $ char = ( chr ( 0xc0 | ( ( $ charCode >> 6 ) & 0x1f ) ) . chr ( 0x80 | ( $ charCode & 0x3...
Convert character code to UTF - 8 character .
39,123
protected function mapData ( $ data ) { $ values = array ( ) ; foreach ( $ data -> buckets as $ bucket ) { $ values [ $ bucket -> key ] = $ bucket -> doc_count ; } return $ values ; }
Map Elasticsearch return array into a sane hash map .
39,124
public function lastInsertId ( $ sequenceName = null ) { if ( isset ( $ this -> lastInsertedIds [ $ sequenceName ] ) ) { $ lastInsertId = $ this -> lastInsertedIds [ $ sequenceName ] ; unset ( $ this -> lastInsertedIds [ $ sequenceName ] ) ; return $ lastInsertId ; } return $ this -> connection -> lastInsertId ( $ sequ...
Retrieve the last auto incremet or sequence id .
39,125
public function getAutoIncrementValue ( $ table , $ column ) { if ( ( $ table === 'ezcontentobject_attribute' ) && ( $ column === 'id' ) ) { $ q = $ this -> createSelectQuery ( ) ; $ q -> select ( $ q -> expr -> max ( 'id' ) ) -> from ( 'ezcontentobject_attribute' ) ; $ statement = $ q -> prepare ( ) ; $ statement -> e...
Get auto increment value .
39,126
public function getSequenceName ( $ table , $ column ) { if ( ( $ table === 'ezcontentobject_attribute' ) && ( $ column === 'id' ) ) { return "{$table}.{$column}" ; } if ( ( $ table === 'ezcontentclass' ) && ( $ column === 'id' ) ) { return "{$table}.{$column}" ; } if ( ( $ table === 'ezcontentclass_attribute' ) && ( $...
Returns the name of the affected sequence .
39,127
public function getTranslatedField ( Content $ content , $ fieldDefIdentifier , $ forcedLanguage = null ) { return $ this -> translationHelper -> getTranslatedField ( $ content , $ fieldDefIdentifier , $ forcedLanguage ) ; }
Returns the translated field very similar to getTranslatedFieldValue but this returns the whole field . To be used with ez_image_alias for example which requires the whole field .
39,128
public function isFieldEmpty ( Content $ content , $ fieldDefIdentifier , $ forcedLanguage = null ) { if ( $ fieldDefIdentifier instanceof Field ) { $ fieldDefIdentifier = $ fieldDefIdentifier -> fieldDefIdentifier ; } return $ this -> fieldHelper -> isFieldEmpty ( $ content , $ fieldDefIdentifier , $ forcedLanguage ) ...
Checks if a given field is considered empty . This method accepts field as Objects or by identifiers .
39,129
public function setHeader ( $ name , $ value ) { if ( ! $ this -> response -> headers -> has ( $ name ) ) { $ this -> response -> headers -> set ( $ name , $ value ) ; } }
Set HTTP response header .
39,130
public function setStatus ( $ statusCode ) { if ( $ this -> statusCode === null ) { $ this -> statusCode = $ statusCode ; $ this -> response -> setStatusCode ( $ statusCode ) ; } }
Sets the given status code in the corresponding header .
39,131
public function isFieldEmpty ( Content $ content , $ fieldDefIdentifier , $ forcedLanguage = null ) { $ field = $ this -> translationHelper -> getTranslatedField ( $ content , $ fieldDefIdentifier , $ forcedLanguage ) ; $ fieldDefinition = $ content -> getContentType ( ) -> getFieldDefinition ( $ fieldDefIdentifier ) ;...
Checks if provided field can be considered empty .
39,132
public function changeStatusTo ( int $ status ) : self { if ( ! in_array ( $ status , [ VersionInfo :: STATUS_DRAFT , VersionInfo :: STATUS_PUBLISHED , VersionInfo :: STATUS_ARCHIVED ] ) ) { throw new InvalidArgumentException ( '$status' , 'Status should be one of the following: STATUS_DRAFT, STATUS_PUBLISHED, STATUS_A...
Set intent to change Version status .
39,133
public function updateFieldsTo ( ? string $ initialLanguageCode , array $ fields ) : self { $ languageCodes = array_map ( function ( Field $ field ) { return $ field -> languageCode ; } , $ fields ) ; $ this -> targetVersionProperties [ 'forUpdateInitialLanguageCode' ] = $ initialLanguageCode ; $ this -> targetVersionP...
Set intent to update Content Version Fields .
39,134
protected function getRequest ( ) { if ( empty ( $ this -> method ) || empty ( $ this -> host ) ) { throw new \ RuntimeException ( 'Attempted to get unspecified Request' ) ; } return new Request ( $ this -> method , $ this -> host . $ this -> resource , $ this -> headers , $ this -> body ) ; }
Prepare and get request .
39,135
public function setHost ( $ host ) { if ( substr ( $ host , - 1 ) === '/' ) { $ host = substr ( $ host , 0 , strlen ( $ host ) - 1 ) ; } $ this -> host = $ host ; }
Set request host .
39,136
public function setHeader ( $ header , $ value ) { if ( is_array ( $ value ) ) { $ value = implode ( ';' , $ value ) ; } $ this -> headers [ $ header ] = $ value ; }
Set request header .
39,137
private function parseImageId ( $ imageId ) { $ idArray = explode ( '-' , $ imageId ) ; if ( count ( $ idArray ) == 2 ) { return array_merge ( $ idArray , [ null ] ) ; } elseif ( count ( $ idArray ) == 3 ) { return $ idArray ; } throw new Exceptions \ NotFoundException ( "Invalid image ID {$imageId}" ) ; }
Parses an imageId string into contentId fieldId and versionNumber .
39,138
protected function insertTypeNameData ( $ typeId , $ typeStatus , array $ languages ) { $ tmpLanguages = $ languages ; if ( isset ( $ tmpLanguages [ 'always-available' ] ) ) { unset ( $ tmpLanguages [ 'always-available' ] ) ; } foreach ( $ tmpLanguages as $ language => $ name ) { $ query = $ this -> dbHandler -> create...
Inserts data into contentclass_name .
39,139
protected function createGroupLoadQuery ( ) { $ q = $ this -> dbHandler -> createSelectQuery ( ) ; $ q -> select ( $ this -> dbHandler -> quoteColumn ( 'created' ) , $ this -> dbHandler -> quoteColumn ( 'creator_id' ) , $ this -> dbHandler -> quoteColumn ( 'id' ) , $ this -> dbHandler -> quoteColumn ( 'modified' ) , $ ...
Creates the basic query to load Group data .
39,140
private function getLoadTypeQueryBuilder ( ) : QueryBuilder { $ q = $ this -> connection -> createQueryBuilder ( ) ; $ expr = $ q -> expr ( ) ; $ q -> select ( [ 'c.id AS ezcontentclass_id' , 'c.version AS ezcontentclass_version' , 'c.serialized_name_list AS ezcontentclass_serialized_name_list' , 'c.serialized_descript...
Returns a basic query to retrieve Type data .
39,141
public function deleteFieldDefinitionsForType ( $ typeId , $ status ) { $ q = $ this -> dbHandler -> createDeleteQuery ( ) ; $ q -> deleteFrom ( $ this -> dbHandler -> quoteTable ( 'ezcontentclass_attribute' ) ) -> where ( $ q -> expr -> lAnd ( $ q -> expr -> eq ( $ this -> dbHandler -> quoteColumn ( 'contentclass_id' ...
Deletes all field definitions of a Type .
39,142
public function delete ( $ typeId , $ status ) { $ this -> deleteGroupAssignmentsForType ( $ typeId , $ status ) ; $ this -> deleteFieldDefinitionsForType ( $ typeId , $ status ) ; $ this -> deleteTypeNameData ( $ typeId , $ status ) ; $ this -> deleteType ( $ typeId , $ status ) ; }
Deletes a Type completely .
39,143
public function deleteGroupAssignmentsForType ( $ typeId , $ status ) { $ q = $ this -> dbHandler -> createDeleteQuery ( ) ; $ q -> deleteFrom ( $ this -> dbHandler -> quoteTable ( 'ezcontentclass_classgroup' ) ) -> where ( $ q -> expr -> lAnd ( $ q -> expr -> eq ( $ this -> dbHandler -> quoteColumn ( 'contentclass_id'...
Deletes all group assignments for a Type .
39,144
public function setAuthentication ( $ user , $ password , $ type = self :: AUTH_TYPE_BASIC ) { $ this -> setHeader ( 'Authorization' , $ this -> makeAuthentication ( $ user , $ password , $ type ) ) ; }
Set authentication .
39,145
public function getHeader ( $ header ) { $ response = $ this -> getResponse ( ) ; return $ response -> hasHeader ( $ header ) ? $ response -> getHeader ( $ header ) [ 0 ] : null ; }
Get response header .
39,146
public function listLocationURLAliases ( $ locationPath , Request $ request ) { $ locationPathParts = explode ( '/' , $ locationPath ) ; $ location = $ this -> locationService -> loadLocation ( array_pop ( $ locationPathParts ) ) ; $ custom = ! ( $ request -> query -> has ( 'custom' ) && $ request -> query -> get ( 'cu...
Returns the list of URL aliases for a location .
39,147
public function createURLAlias ( Request $ request ) { $ urlAliasCreate = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; if ( $ urlAliasCreate [ '_type' ] === 'LOCATION' ) { $ locationPathParts = explode (...
Creates a new URL alias .
39,148
public function deleteURLAlias ( $ urlAliasId ) { $ this -> urlAliasService -> removeAliases ( array ( $ this -> urlAliasService -> load ( $ urlAliasId ) , ) ) ; return new Values \ NoContent ( ) ; }
The given URL alias is deleted .
39,149
protected function createLegacyXml ( array $ data ) { $ data [ 'uri' ] = $ this -> urlRedecorator -> redecorateFromSource ( $ data [ 'uri' ] ) ; $ pathInfo = pathinfo ( $ data [ 'uri' ] ) ; return $ this -> fillXml ( $ data , $ pathInfo , time ( ) ) ; }
Returns the XML required by the legacy database .
39,150
protected function fillXml ( $ imageData , $ pathInfo , $ timestamp ) { $ xml = <<<EOT<?xml version="1.0" encoding="utf-8"?><ezimage serial_number="1" is_valid="%s" filename="%s" suffix="%s" basename="%s" dirpath="%s" url="%s" original_filename="%s" mime_type="%s" width="%s" height="%s" alternative_text="%s" ...
Fill the XML template with the data provided .
39,151
protected function parseLegacyXml ( $ xml ) { $ extractedData = array ( ) ; $ dom = new \ DOMDocument ( ) ; $ dom -> loadXml ( $ xml ) ; $ ezimageTag = $ dom -> documentElement ; if ( ! $ ezimageTag -> hasAttribute ( 'url' ) ) { throw new \ RuntimeException ( 'Missing attribute "url" in <ezimage/> tag.' ) ; } if ( ( $ ...
Parses the XML from the legacy database .
39,152
public function searchUserByLogin ( $ username , $ parentGroupId = null ) { try { $ user = $ this -> userService -> loadUserByLogin ( $ username ) ; } catch ( ApiExceptions \ NotFoundException $ e ) { return null ; } if ( $ user && $ parentGroupId ) { $ userGroups = $ this -> userService -> loadUserGroupsOfUser ( $ use...
Search User with given username optionally at given location .
39,153
public function searchUserGroups ( $ name , $ parentLocationId = null ) { $ criterionArray = array ( new Criterion \ Subtree ( self :: USERGROUP_ROOT_SUBTREE ) , new Criterion \ ContentTypeIdentifier ( self :: USERGROUP_CONTENT_IDENTIFIER ) , new Criterion \ Field ( 'name' , Criterion \ Operator :: EQ , $ name ) , ) ; ...
Search User Groups with given name .
39,154
protected function createUser ( $ username , $ email , $ password , $ parentGroup = null , $ fields = array ( ) ) { $ userCreateStruct = $ this -> userService -> newUserCreateStruct ( $ username , $ email , $ password , self :: DEFAULT_LANGUAGE ) ; $ userCreateStruct -> setField ( 'first_name' , $ username ) ; $ userCr...
Create user inside given User Group ; DELETES existing User if login already exists!
39,155
public function createUserGroup ( $ name , $ parentGroup = null ) { if ( ! $ parentGroup ) { $ parentGroup = $ this -> userService -> loadUserGroup ( self :: USERGROUP_ROOT_CONTENT_ID ) ; } $ userGroupCreateStruct = $ this -> userService -> newUserGroupCreateStruct ( 'eng-GB' ) ; $ userGroupCreateStruct -> setField ( '...
Create new User Group inside existing parent User Group .
39,156
private function findNonExistingUserName ( ) { for ( $ i = 0 ; $ i < 20 ; ++ $ i ) { $ username = uniqid ( 'User#' , true ) ; if ( ! $ this -> checkUserExistenceByUsername ( $ username ) ) { return $ username ; } } throw new \ Exception ( 'Possible endless loop when attempting to find a new name for User.' ) ; }
Find a non existing User name .
39,157
public function onKernelRequestRedirect ( GetResponseEvent $ event ) { if ( $ event -> getRequestType ( ) == HttpKernelInterface :: MASTER_REQUEST ) { $ request = $ event -> getRequest ( ) ; if ( $ request -> attributes -> get ( 'needsRedirect' ) && $ request -> attributes -> has ( 'semanticPathinfo' ) ) { $ siteaccess...
Checks if the request needs to be redirected and return a RedirectResponse in such case . The request attributes needsRedirect and semanticPathinfo are originally set in the UrlAliasRouter .
39,158
public function createBookmark ( Request $ request , int $ locationId ) : RestValue { $ location = $ this -> locationService -> loadLocation ( $ locationId ) ; try { $ this -> bookmarkService -> createBookmark ( $ location ) ; return new Values \ ResourceCreated ( $ this -> router -> generate ( 'ezpublish_rest_isBookma...
Add given location to bookmarks .
39,159
public function deleteBookmark ( Request $ request , int $ locationId ) : RestValue { $ location = $ this -> locationService -> loadLocation ( $ locationId ) ; try { $ this -> bookmarkService -> deleteBookmark ( $ location ) ; return new Values \ NoContent ( ) ; } catch ( InvalidArgumentException $ e ) { throw new Exce...
Deletes a given bookmark .
39,160
public function isBookmarked ( Request $ request , int $ locationId ) : Values \ OK { $ location = $ this -> locationService -> loadLocation ( $ locationId ) ; if ( ! $ this -> bookmarkService -> isBookmarked ( $ location ) ) { throw new Exceptions \ NotFoundException ( "Location {$locationId} is not bookmarked" ) ; } ...
Checks if given location is bookmarked .
39,161
public function loadBookmarks ( Request $ request ) : RestValue { $ offset = $ request -> query -> getInt ( 'offset' , 0 ) ; $ limit = $ request -> query -> getInt ( 'limit' , 25 ) ; $ restLocations = [ ] ; $ bookmarks = $ this -> bookmarkService -> loadBookmarks ( $ offset , $ limit ) ; foreach ( $ bookmarks as $ book...
List bookmarked locations .
39,162
public static function createFromDSN ( $ dsn ) { if ( is_string ( $ dsn ) ) { $ parsed = self :: parseDSN ( $ dsn ) ; } else { $ parsed = $ dsn ; } $ connection = DriverManager :: getConnection ( $ parsed ) ; if ( $ parsed [ 'driver' ] === 'pdo_sqlite' ) { return new ConnectionHandler \ SqliteConnectionHandler ( $ conn...
Create a Connection Handler with corresponding Doctrine connection from DSN .
39,163
public function buildContentDomainObject ( SPIContent $ spiContent , ContentType $ contentType , array $ prioritizedLanguages = [ ] , string $ fieldAlwaysAvailableLanguage = null ) { $ prioritizedFieldLanguageCode = null ; if ( ! empty ( $ prioritizedLanguages ) ) { $ availableFieldLanguageMap = array_fill_keys ( $ spi...
Builds a Content domain object from value object returned from persistence .
39,164
public function buildDomainFields ( array $ spiFields , $ contentType , array $ prioritizedLanguages = [ ] , string $ alwaysAvailableLanguage = null ) { if ( ! $ contentType instanceof SPIType && ! $ contentType instanceof ContentType ) { throw new InvalidArgumentType ( '$contentType' , 'SPI ContentType | API ContentTy...
Returns an array of domain fields created from given array of SPI fields .
39,165
public function buildVersionInfoDomainObject ( SPIVersionInfo $ spiVersionInfo , array $ prioritizedLanguages = [ ] ) { switch ( $ spiVersionInfo -> status ) { case SPIVersionInfo :: STATUS_ARCHIVED : $ status = APIVersionInfo :: STATUS_ARCHIVED ; break ; case SPIVersionInfo :: STATUS_PUBLISHED : $ status = APIVersionI...
Builds a VersionInfo domain object from value object returned from persistence .
39,166
public function buildContentInfoDomainObject ( SPIContentInfo $ spiContentInfo ) { switch ( $ spiContentInfo -> status ) { case SPIContentInfo :: STATUS_TRASHED : $ status = ContentInfo :: STATUS_TRASHED ; break ; case SPIContentInfo :: STATUS_PUBLISHED : $ status = ContentInfo :: STATUS_PUBLISHED ; break ; case SPICon...
Builds a ContentInfo domain object from value object returned from persistence .
39,167
public function buildRelationDomainObject ( SPIRelation $ spiRelation , ContentInfo $ sourceContentInfo , ContentInfo $ destinationContentInfo ) { $ sourceFieldDefinitionIdentifier = null ; if ( $ spiRelation -> sourceFieldDefinitionId !== null ) { $ contentType = $ this -> contentTypeHandler -> load ( $ sourceContentI...
Builds API Relation object from provided SPI Relation object .
39,168
private function buildRootLocation ( SPILocation $ spiLocation ) : APILocation { $ legacyDateTime = $ this -> getDateTime ( 1030968000 ) ; return $ this -> mapLocation ( $ spiLocation , new ContentInfo ( [ 'id' => 0 , 'name' => 'Top Level Nodes' , 'sectionId' => 1 , 'mainLocationId' => 1 , 'contentTypeId' => 1 , 'curre...
Builds API Location object for tree root .
39,169
public function buildContentDomainObjectsOnSearchResult ( SearchResult $ result , array $ languageFilter ) { if ( empty ( $ result -> searchHits ) ) { return [ ] ; } $ contentIds = [ ] ; $ contentTypeIds = [ ] ; $ translations = $ languageFilter [ 'languages' ] ?? [ ] ; $ useAlwaysAvailable = $ languageFilter [ 'useAlw...
Build API Content domain objects in bulk and apply to ContentSearchResult .
39,170
public function buildLocationDomainObjectsOnSearchResult ( SearchResult $ result , array $ languageFilter ) { if ( empty ( $ result -> searchHits ) ) { return [ ] ; } $ contentIds = [ ] ; foreach ( $ result -> searchHits as $ hit ) { $ contentIds [ ] = $ hit -> valueObject -> contentId ; } $ missingLocations = [ ] ; $ ...
Build API Location and corresponding ContentInfo domain objects and apply to LocationSearchResult .
39,171
public function buildSPILocationCreateStruct ( $ locationCreateStruct , APILocation $ parentLocation , $ mainLocation , $ contentId , $ contentVersionNo ) { if ( ! $ this -> isValidLocationPriority ( $ locationCreateStruct -> priority ) ) { throw new InvalidArgumentValue ( 'priority' , $ locationCreateStruct -> priorit...
Creates an array of SPI location create structs from given array of API location create structs .
39,172
public function renderTemplate ( $ name , $ type , array $ parameters , $ isInline ) { switch ( $ type ) { case 'style' : $ templateName = $ this -> getStyleTemplateName ( $ name , $ isInline ) ; break ; case 'tag' : default : $ templateName = $ this -> getTagTemplateName ( $ name , $ isInline ) ; } if ( $ templateName...
Renders template tag .
39,173
protected function getStyleTemplateName ( $ identifier , $ isInline ) { if ( ! empty ( $ this -> customStylesConfiguration [ $ identifier ] [ 'template' ] ) ) { return $ this -> customStylesConfiguration [ $ identifier ] [ 'template' ] ; } $ this -> logger -> warning ( "Template style '{$identifier}' configuration was ...
Returns configured template name for the given Custom Style identifier .
39,174
protected function getTagTemplateName ( $ identifier , $ isInline ) { if ( isset ( $ this -> customTagsConfiguration [ $ identifier ] ) ) { return $ this -> customTagsConfiguration [ $ identifier ] [ 'template' ] ; } $ configurationReference = $ this -> tagConfigurationNamespace . '.' . $ identifier ; if ( $ this -> co...
Returns configured template name for the given template tag identifier .
39,175
protected function getEmbedTemplateName ( $ resourceType , $ isInline , $ isDenied ) { $ configurationReference = $ this -> embedConfigurationNamespace ; if ( $ resourceType === static :: RESOURCE_TYPE_CONTENT ) { $ configurationReference .= '.content' ; } else { $ configurationReference .= '.location' ; } if ( $ isInl...
Returns configured template reference for the given embed parameters .
39,176
public function getCustomField ( $ type , $ field ) { if ( ! isset ( $ this -> customFields [ $ type ] ) || ! isset ( $ this -> customFields [ $ type ] [ $ field ] ) ) { return null ; } return $ this -> customFields [ $ type ] [ $ field ] ; }
Return custom field .
39,177
public function isUriPrefixExcluded ( $ uri ) { foreach ( $ this -> excludedUriPrefixes as $ excludedPrefix ) { $ excludedPrefix = '/' . trim ( $ excludedPrefix , '/' ) ; if ( mb_stripos ( $ uri , $ excludedPrefix ) === 0 ) { return true ; } } return false ; }
Checks if passed URI has an excluded prefix when a root location is defined .
39,178
public function validate ( FieldDefinition $ fieldDefinition , SPIValue $ fieldValue ) { $ validationErrors = array ( ) ; if ( $ this -> isEmptyValue ( $ fieldValue ) ) { return $ validationErrors ; } $ fieldSettings = $ fieldDefinition -> getFieldSettings ( ) ; if ( ( ! isset ( $ fieldSettings [ 'isMultiple' ] ) || $ ...
Validates field value against isMultiple and options settings .
39,179
public function getFromRegistry ( $ controllerString ) { if ( ! is_string ( $ controllerString ) ) { return null ; } foreach ( $ this -> registry as $ viewBuilder ) { if ( $ viewBuilder -> matches ( $ controllerString ) ) { return $ viewBuilder ; } } return null ; }
Returns the ViewBuilder that matches the given controller string .
39,180
public function onRouteReferenceGeneration ( RouteReferenceGenerationEvent $ event ) { $ routeReference = $ event -> getRouteReference ( ) ; if ( ! $ routeReference -> has ( 'language' ) ) { return ; } $ language = $ routeReference -> get ( 'language' ) ; $ routeReference -> remove ( 'language' ) ; $ siteAccess = $ thi...
If language parameter is present will try to get corresponding SiteAccess for translation . If found it will add siteaccess parameter to the RouteReference to trigger SiteAccess switch when generating the final link .
39,181
protected function parseArguments ( array $ args ) { if ( count ( $ args ) === 1 && is_array ( $ args [ 0 ] ) ) { $ args = $ args [ 0 ] ; } if ( count ( $ args ) === 0 ) { throw new QueryException ( 'No arguments given' ) ; } return $ args ; }
Parse the arguments and validate for existance of values .
39,182
public function createRole ( APIRoleCreateStruct $ roleCreateStruct ) { $ inputMessage = $ this -> outputVisitor -> visit ( $ roleCreateStruct ) ; $ inputMessage -> headers [ 'Accept' ] = $ this -> outputVisitor -> getMediaType ( 'Role' ) ; $ result = $ this -> client -> request ( 'POST' , $ this -> requestParser -> ge...
Creates a new Role draft .
39,183
public function removePolicy ( APIRole $ role , APIPolicy $ policy ) { $ values = $ this -> requestParser -> parse ( 'role' , $ role -> id ) ; $ response = $ this -> client -> request ( 'DELETE' , $ this -> requestParser -> generate ( 'policy' , array ( 'role' => $ values [ 'role' ] , 'policy' => $ policy -> id , ) ) ,...
Removes a policy from the role .
39,184
public function loadRoleByIdentifier ( $ name ) { $ response = $ this -> client -> request ( 'GET' , $ this -> requestParser -> generate ( 'roleByIdentifier' , array ( 'role' => $ name ) ) , new Message ( array ( 'Accept' => $ this -> outputVisitor -> getMediaType ( 'RoleList' ) ) ) ) ; $ result = $ this -> inputDispat...
Loads a role for the given name .
39,185
public function loadTrashItems ( Request $ request ) { $ offset = $ request -> query -> has ( 'offset' ) ? ( int ) $ request -> query -> get ( 'offset' ) : 0 ; $ limit = $ request -> query -> has ( 'limit' ) ? ( int ) $ request -> query -> get ( 'limit' ) : - 1 ; $ query = new Query ( ) ; $ query -> offset = $ offset >...
Returns a list of all trash items .
39,186
public function loadTrashItem ( $ trashItemId ) { return new Values \ RestTrashItem ( $ trashItem = $ this -> trashService -> loadTrashItem ( $ trashItemId ) , $ this -> locationService -> getLocationChildCount ( $ trashItem ) ) ; }
Returns the trash item given by id .
39,187
public function deleteTrashItem ( $ trashItemId ) { $ this -> trashService -> deleteTrashItem ( $ this -> trashService -> loadTrashItem ( $ trashItemId ) ) ; return new Values \ NoContent ( ) ; }
Deletes the given trash item .
39,188
public function restoreTrashItem ( $ trashItemId , Request $ request ) { $ requestDestination = null ; try { $ requestDestination = $ request -> headers -> get ( 'Destination' ) ; } catch ( InvalidArgumentException $ e ) { } $ parentLocation = null ; if ( $ request -> headers -> has ( 'Destination' ) ) { $ locationPath...
Restores a trashItem .
39,189
public function checkSiteAccessPermission ( BaseInteractiveLoginEvent $ event ) { $ token = $ event -> getAuthenticationToken ( ) ; $ originalUser = $ token -> getUser ( ) ; $ request = $ event -> getRequest ( ) ; $ siteAccess = $ request -> attributes -> get ( 'siteaccess' ) ; if ( ! ( $ originalUser instanceof eZUser...
Throws an UnauthorizedSiteAccessException if current user doesn t have permission to current SiteAccess .
39,190
public function onKernelRequest ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( ! $ this -> isMasterRequest ( $ request , $ event -> getRequestType ( ) ) ) { return ; } $ siteAccess = $ request -> attributes -> get ( 'siteaccess' ) ; if ( ! $ siteAccess instanceof SiteAccess ) { return ; } $...
Throws an UnauthorizedSiteAccessException if current user doesn t have access to current SiteAccess .
39,191
public function update ( Language $ language ) { $ this -> innerHandler -> update ( $ language ) ; $ this -> storeCache ( [ $ language ] ) ; }
Update language .
39,192
protected function storeCache ( array $ languages , string $ listIndex = null ) : void { $ this -> cache -> setMulti ( $ languages , static function ( Language $ language ) { return [ 'ez-language-' . $ language -> id , 'ez-language-code-' . $ language -> languageCode , ] ; } , $ listIndex ) ; }
Helper to store languages in internal in - memory cache with all needed keys .
39,193
public function assignSectionToSubtree ( Location $ location , Section $ section ) : void { $ this -> service -> assignSectionToSubtree ( $ location , $ section ) ; $ this -> signalDispatcher -> emit ( new AssignSectionToSubtreeSignal ( [ 'locationId' => $ location -> id , 'sectionId' => $ section -> id , ] ) ) ; }
Assigns the subtree to the given section .
39,194
public function getContext ( ) { try { return $ this -> innerGateway -> getContext ( ) ; } catch ( DBALException $ e ) { throw new RuntimeException ( 'Database error' , 0 , $ e ) ; } catch ( PDOException $ e ) { throw new RuntimeException ( 'Database error' , 0 , $ e ) ; } }
Get context definition for external storage layers .
39,195
public function updateField ( Field $ field , StorageFieldValue $ value ) { try { return $ this -> innerGateway -> updateField ( $ field , $ value ) ; } catch ( DBALException $ e ) { throw new RuntimeException ( 'Database error' , 0 , $ e ) ; } catch ( PDOException $ e ) { throw new RuntimeException ( 'Database error' ...
Updates an existing field .
39,196
public function loadContentInfoByRemoteId ( $ remoteId ) { try { return $ this -> innerGateway -> loadContentInfoByRemoteId ( $ remoteId ) ; } catch ( DBALException $ e ) { throw new \ RuntimeException ( 'Database error' , 0 , $ e ) ; } catch ( \ PDOException $ e ) { throw new \ RuntimeException ( 'Database error' , 0 ...
Loads data for a content object identified by its remote ID .
39,197
public function setName ( $ contentId , $ version , $ name , $ language ) { try { return $ this -> innerGateway -> setName ( $ contentId , $ version , $ name , $ language ) ; } catch ( DBALException $ e ) { throw new RuntimeException ( 'Database error' , 0 , $ e ) ; } catch ( PDOException $ e ) { throw new RuntimeExcep...
Sets the content object name .
39,198
public function deleteTranslationFromContent ( $ contentId , $ languageCode ) { try { return $ this -> innerGateway -> deleteTranslationFromContent ( $ contentId , $ languageCode ) ; } catch ( DBALException $ e ) { throw new RuntimeException ( 'Database error' , 0 , $ e ) ; } catch ( PDOException $ e ) { throw new Runt...
Remove the specified translation from all the Versions of a Content Object .
39,199
public function parse ( array $ data , ParsingDispatcher $ parsingDispatcher ) { if ( ! array_key_exists ( 'AND' , $ data ) && ! is_array ( $ data [ 'AND' ] ) ) { throw new Exceptions \ Parser ( 'Invalid <AND> format' ) ; } $ criteria = array ( ) ; foreach ( $ data [ 'AND' ] as $ criterionName => $ criterionData ) { if...
Parses input structure to a LogicalAnd Criterion object .