idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
39,300
public function loadUserGroup ( $ groupPath ) { $ userGroupLocation = $ this -> locationService -> loadLocation ( $ this -> extractLocationIdFromPath ( $ groupPath ) ) ; if ( trim ( $ userGroupLocation -> pathString , '/' ) != $ groupPath ) { throw new NotFoundException ( "Could not find location with path string $grou...
Loads a user group for the given path .
39,301
public function loadUser ( $ userId ) { $ user = $ this -> userService -> loadUser ( $ userId , Language :: ALL ) ; $ userContentInfo = $ user -> getVersionInfo ( ) -> getContentInfo ( ) ; $ contentType = $ this -> contentTypeService -> loadContentType ( $ userContentInfo -> contentTypeId ) ; try { $ userMainLocation =...
Loads a user for the given ID .
39,302
public function createUser ( $ groupPath , Request $ request ) { $ userGroupLocation = $ this -> locationService -> loadLocation ( $ this -> extractLocationIdFromPath ( $ groupPath ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ userGroupLocation -> contentId ) ; $ userCreateStruct = $ this -> inputDispa...
Create a new user group in the given group .
39,303
public function updateUserGroup ( $ groupPath , Request $ request ) { $ userGroupLocation = $ this -> locationService -> loadLocation ( $ this -> extractLocationIdFromPath ( $ groupPath ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ userGroupLocation -> contentId ) ; $ updateStruct = $ this -> inputDisp...
Updates a user group .
39,304
public function deleteUserGroup ( $ groupPath ) { $ userGroupLocation = $ this -> locationService -> loadLocation ( $ this -> extractLocationIdFromPath ( $ groupPath ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ userGroupLocation -> contentId ) ; $ users = $ this -> userService -> loadUsersOfUserGroup ...
Given user group is deleted .
39,305
public function deleteUser ( $ userId ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; if ( $ user -> id == $ this -> repository -> getCurrentUser ( ) -> id ) { throw new Exceptions \ ForbiddenException ( 'Currently authenticated user cannot be deleted' ) ; } $ this -> userService -> deleteUser ( $ user ) ...
Given user is deleted .
39,306
public function loadUsers ( Request $ request ) { $ restUsers = array ( ) ; try { if ( $ request -> query -> has ( 'roleId' ) ) { $ restUsers = $ this -> loadUsersAssignedToRole ( $ this -> requestParser -> parseHref ( $ request -> query -> get ( 'roleId' ) , 'roleId' ) ) ; } elseif ( $ request -> query -> has ( 'remot...
Loads users .
39,307
public function loadUsersAssignedToRole ( $ roleId ) { $ role = $ this -> roleService -> loadRole ( $ roleId ) ; $ roleAssignments = $ this -> roleService -> getRoleAssignments ( $ role ) ; $ restUsers = array ( ) ; foreach ( $ roleAssignments as $ roleAssignment ) { if ( $ roleAssignment instanceof UserRoleAssignment ...
Loads a list of users assigned to role .
39,308
public function loadUserGroups ( Request $ request ) { $ restUserGroups = array ( ) ; if ( $ request -> query -> has ( 'id' ) ) { $ userGroup = $ this -> userService -> loadUserGroup ( $ request -> query -> get ( 'id' ) , Language :: ALL ) ; $ userGroupContentInfo = $ userGroup -> getVersionInfo ( ) -> getContentInfo (...
Loads user groups .
39,309
public function loadUserGroupByRemoteId ( Request $ request ) { $ contentInfo = $ this -> contentService -> loadContentInfoByRemoteId ( $ request -> query -> get ( 'remoteId' ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ contentInfo -> id , Language :: ALL ) ; $ userGroupLocation = $ this -> locationSe...
Loads a user group by its remote ID .
39,310
public function loadUserGroupsAssignedToRole ( $ roleId ) { $ role = $ this -> roleService -> loadRole ( $ roleId ) ; $ roleAssignments = $ this -> roleService -> getRoleAssignments ( $ role ) ; $ restUserGroups = array ( ) ; foreach ( $ roleAssignments as $ roleAssignment ) { if ( $ roleAssignment instanceof UserGroup...
Loads a list of user groups assigned to role .
39,311
public function loadUserDrafts ( $ userId , Request $ request ) { $ contentDrafts = $ this -> contentService -> loadContentDrafts ( $ this -> userService -> loadUser ( $ userId ) ) ; return new Values \ VersionList ( $ contentDrafts , $ request -> getPathInfo ( ) ) ; }
Loads drafts assigned to user .
39,312
public function loadSubUserGroups ( $ groupPath , Request $ request ) { $ offset = $ request -> query -> has ( 'offset' ) ? ( int ) $ request -> query -> get ( 'offset' ) : 0 ; $ limit = $ request -> query -> has ( 'limit' ) ? ( int ) $ request -> query -> get ( 'limit' ) : 25 ; $ userGroupLocation = $ this -> location...
Returns a list of the sub groups .
39,313
public function loadUserGroupsOfUser ( $ userId , Request $ request ) { $ offset = $ request -> query -> has ( 'offset' ) ? ( int ) $ request -> query -> get ( 'offset' ) : 0 ; $ limit = $ request -> query -> has ( 'limit' ) ? ( int ) $ request -> query -> get ( 'limit' ) : 25 ; $ user = $ this -> userService -> loadUs...
Returns a list of user groups the user belongs to . The returned list includes the resources for unassigning a user group if the user is in multiple groups .
39,314
public function loadUsersFromGroup ( $ groupPath , Request $ request ) { $ userGroupLocation = $ this -> locationService -> loadLocation ( $ this -> extractLocationIdFromPath ( $ groupPath ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ userGroupLocation -> contentId ) ; $ offset = $ request -> query -> ...
Loads the users of the group with the given path .
39,315
public function unassignUserFromUserGroup ( $ userId , $ groupPath ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; $ userGroupLocation = $ this -> locationService -> loadLocation ( trim ( $ groupPath , '/' ) ) ; $ userGroup = $ this -> userService -> loadUserGroup ( $ userGroupLocation -> contentId ) ; tr...
Unassigns the user from a user group .
39,316
public function assignUserToUserGroup ( $ userId , Request $ request ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; try { $ userGroupLocation = $ this -> locationService -> loadLocation ( $ this -> extractLocationIdFromPath ( $ request -> query -> get ( 'group' ) ) ) ; } catch ( ApiExceptions \ NotFoundE...
Assigns the user to a user group .
39,317
public function parse ( array $ data , ParsingDispatcher $ parsingDispatcher ) { if ( ! array_key_exists ( 'LanguageCodeCriterion' , $ data ) ) { throw new Exceptions \ Parser ( 'Invalid <LanguageCodeCriterion> format' ) ; } return new LanguageCodeCriterion ( explode ( ',' , $ data [ 'LanguageCodeCriterion' ] ) ) ; }
Parses input structure to a LanguageCode Criterion object .
39,318
public function updateUserToken ( User $ user , UserTokenUpdateStruct $ userTokenUpdateStruct ) { $ returnValue = $ this -> service -> updateUserToken ( $ user , $ userTokenUpdateStruct ) ; $ this -> signalDispatcher -> emit ( new UpdateUserTokenSignal ( [ 'userId' => $ user -> id ] ) ) ; return $ returnValue ; }
Update the user account key information specified by the user account key struct .
39,319
public function addSlotsForSearchEngine ( $ searchEngineAlias , array $ searchEngineSignalSlots ) { if ( $ this -> getSearchEngineAlias ( ) !== $ searchEngineAlias ) { return ; } foreach ( $ searchEngineSignalSlots as $ signalIdentifier => $ slots ) { if ( $ signalIdentifier [ 0 ] === '\\' ) { $ signalIdentifier = subs...
Bulk add all signal slots if needed for a search engine .
39,320
public function transform ( $ string , array $ ruleNames = array ( ) ) { $ rules = $ this -> getRules ( ) ; foreach ( $ ruleNames ? : array_keys ( $ rules ) as $ ruleName ) { if ( ! isset ( $ rules [ $ ruleName ] ) ) { continue ; } foreach ( $ rules [ $ ruleName ] as $ rule ) { $ string = preg_replace_callback ( $ rule...
Transform the given string .
39,321
public function transformByGroup ( $ string , $ ruleGroup ) { $ rules = $ this -> getRules ( ) ; foreach ( array_keys ( $ rules ) as $ ruleName ) { if ( strpos ( $ ruleName , $ ruleGroup ) === false ) { continue ; } foreach ( $ rules [ $ ruleName ] as $ rule ) { $ string = preg_replace_callback ( $ rule [ 'regexp' ] , ...
Transform the given string by group .
39,322
public function addPattern ( $ type , $ pattern ) { $ this -> map [ $ type ] = $ pattern ; unset ( $ this -> compileCache [ $ type ] ) ; }
Adds a pattern for a type .
39,323
public function parse ( $ url ) { foreach ( $ this -> map as $ pattern ) { $ pattern = $ this -> compile ( $ pattern ) ; if ( preg_match ( $ pattern , $ url , $ match ) ) { foreach ( $ match as $ key => $ value ) { if ( is_numeric ( $ key ) ) { unset ( $ match [ $ key ] ) ; } } return $ match ; } } throw new Exceptions...
Parse URL and return the IDs contained in the URL .
39,324
protected function compile ( $ pattern ) { if ( isset ( $ this -> compileCache [ $ pattern ] ) ) { return $ this -> compileCache [ $ pattern ] ; } $ pcre = '(^' ; do { switch ( true ) { case preg_match ( '(^[^{]+)' , $ pattern , $ match ) : $ pattern = substr ( $ pattern , strlen ( $ match [ 0 ] ) ) ; $ pcre .= preg_qu...
Compiles a given pattern to a PCRE regular expression .
39,325
public function generate ( $ type , array $ values = array ( ) ) { if ( ! isset ( $ this -> map [ $ type ] ) ) { throw new Exceptions \ InvalidArgumentException ( "No URL for type '$type' available." ) ; } $ url = $ this -> map [ $ type ] ; preg_match_all ( '(' . self :: STANDARD_VARIABLE_REGEX . '|' . self :: SLASHES_...
Generate a URL of the given type from the specified values .
39,326
protected function getGroupMap ( array $ limitIds = null ) { $ query = $ this -> dbHandler -> createSelectQuery ( ) ; $ query -> select ( $ this -> dbHandler -> quoteColumn ( 'identifier' , 'ezcobj_state_group' ) , $ this -> dbHandler -> quoteColumn ( 'id' , 'ezcobj_state' ) ) -> from ( $ this -> dbHandler -> quoteTabl...
Query for groups identifiers and id s .
39,327
public function loadRoleAssignmentsByRoleId ( $ roleId ) { try { return $ this -> innerGateway -> loadRoleAssignmentsByRoleId ( $ roleId ) ; } catch ( DBALException $ e ) { throw new RuntimeException ( 'Database error' , 0 , $ e ) ; } catch ( PDOException $ e ) { throw new RuntimeException ( 'Database error' , 0 , $ e ...
Loads role assignments for given role ID .
39,328
protected function buildTrashItem ( Location $ location ) { return new TrashItem ( array ( 'contentInfo' => $ location -> contentInfo , 'id' => $ location -> id , 'priority' => $ location -> priority , 'hidden' => $ location -> hidden , 'invisible' => $ location -> invisible , 'remoteId' => $ location -> remoteId , 'pa...
Converts the Location value object to TrashItem value object .
39,329
public function disableLanguage ( Language $ language ) { $ returnValue = $ this -> service -> disableLanguage ( $ language ) ; $ this -> signalDispatcher -> emit ( new DisableLanguageSignal ( array ( 'languageId' => $ language -> id , ) ) ) ; return $ returnValue ; }
Disables a language .
39,330
public function dispatch ( DOMDocument $ document ) { $ documentNamespace = $ document -> documentElement -> lookupNamespaceURI ( null ) ; if ( $ documentNamespace === null ) { $ documentNamespace = $ document -> documentElement -> lookupNamespaceURI ( 'xhtml' ) ; } foreach ( $ this -> mapping as $ namespace => $ conve...
Dispatches DOMDocument to the namespace mapped converter .
39,331
public function onKernelRequestIndex ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ semanticPathinfo = $ request -> attributes -> get ( 'semanticPathinfo' ) ? : '/' ; if ( $ event -> getRequestType ( ) === HttpKernelInterface :: MASTER_REQUEST && $ semanticPathinfo === '/' ) { $ indexPage = $ ...
Checks if the IndexPage is configured and which page must be shown .
39,332
public function toHash ( SPIValue $ value ) { if ( $ this -> isEmptyValue ( $ value ) ) { return null ; } return $ this -> hashConverter -> convertFromValue ( $ value ) ; }
Converts a Value to a hash .
39,333
public function getFieldTypes ( ) { foreach ( $ this -> fieldTypeRegistry -> getFieldTypes ( ) as $ identifier => $ spiFieldType ) { if ( isset ( $ this -> fieldTypes [ $ identifier ] ) ) { continue ; } $ this -> fieldTypes [ $ identifier ] = new FieldType ( $ spiFieldType ) ; } return $ this -> fieldTypes ; }
Returns a list of all field types .
39,334
public function redirectContent ( Request $ request ) { if ( ! $ request -> query -> has ( 'remoteId' ) ) { throw new BadRequestException ( "'remoteId' parameter is required." ) ; } $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfoByRemoteId ( $ request -> query -> get ( 'remoteId' ) ) ; ...
Loads a content info by remote ID .
39,335
public function loadContent ( $ contentId , Request $ request ) { $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) ; $ mainLocation = null ; if ( ! empty ( $ contentInfo -> mainLocationId ) ) { $ mainLocation = $ this -> repository -> getLocationService ( ) -> loadLocatio...
Loads a content info potentially with the current version embedded .
39,336
public function updateContentMetadata ( $ contentId , Request $ request ) { $ updateStruct = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; $ contentInfo = $ this -> repository -> getContentService ( ) -> ...
Updates a content s metadata .
39,337
public function copyContent ( $ contentId , Request $ request ) { $ destination = $ request -> headers -> get ( 'Destination' ) ; $ parentLocationParts = explode ( '/' , $ destination ) ; $ copiedContent = $ this -> repository -> getContentService ( ) -> copyContent ( $ this -> repository -> getContentService ( ) -> lo...
Creates a new content object as copy under the given parent location given in the destination header .
39,338
public function deleteContentTranslation ( $ contentId , $ languageCode ) { $ contentService = $ this -> repository -> getContentService ( ) ; $ this -> repository -> beginTransaction ( ) ; try { $ contentInfo = $ contentService -> loadContentInfo ( $ contentId ) ; $ contentService -> deleteTranslation ( $ contentInfo ...
Deletes a translation from all the Versions of the given Content Object .
39,339
public function loadContentVersions ( $ contentId , Request $ request ) { $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) ; return new Values \ VersionList ( $ this -> repository -> getContentService ( ) -> loadVersions ( $ contentInfo ) , $ request -> getPathInfo ( ) ) ...
Returns a list of all versions of the content . This method does not include fields and relations in the Version elements of the response .
39,340
public function deleteContentVersion ( $ contentId , $ versionNumber ) { $ versionInfo = $ this -> repository -> getContentService ( ) -> loadVersionInfo ( $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) , $ versionNumber ) ; if ( $ versionInfo -> isPublished ( ) ) { throw new Forbidden...
The version is deleted .
39,341
public function deleteTranslationFromDraft ( $ contentId , $ versionNumber , $ languageCode ) { $ contentService = $ this -> repository -> getContentService ( ) ; $ versionInfo = $ contentService -> loadVersionInfoById ( $ contentId , $ versionNumber ) ; if ( ! $ versionInfo -> isDraft ( ) ) { throw new ForbiddenExcept...
Remove the given Translation from the given Version Draft .
39,342
public function createDraftFromVersion ( $ contentId , $ versionNumber ) { $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) ; $ contentType = $ this -> repository -> getContentTypeService ( ) -> loadContentType ( $ contentInfo -> contentTypeId ) ; $ contentDraft = $ this ...
The system creates a new draft version as a copy from the given version .
39,343
public function createDraftFromCurrentVersion ( $ contentId ) { $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) ; $ contentType = $ this -> repository -> getContentTypeService ( ) -> loadContentType ( $ contentInfo -> contentTypeId ) ; $ versionInfo = $ this -> repositor...
The system creates a new draft version as a copy from the current version .
39,344
public function updateVersion ( $ contentId , $ versionNumber , Request $ request ) { $ contentUpdateStruct = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) , 'Url' => $ this -> router -> generate ( 'ezpublish_rest_updateVersion' , array ( 'co...
A specific draft is updated .
39,345
public function publishVersion ( $ contentId , $ versionNumber ) { $ versionInfo = $ this -> repository -> getContentService ( ) -> loadVersionInfo ( $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) , $ versionNumber ) ; if ( ! $ versionInfo -> isDraft ( ) ) { throw new ForbiddenExceptio...
The content version is published .
39,346
public function loadVersionRelations ( $ contentId , $ versionNumber , Request $ request ) { $ offset = $ request -> query -> has ( 'offset' ) ? ( int ) $ request -> query -> get ( 'offset' ) : 0 ; $ limit = $ request -> query -> has ( 'limit' ) ? ( int ) $ request -> query -> get ( 'limit' ) : - 1 ; $ contentInfo = $ ...
Loads the relations of the given version .
39,347
public function loadVersionRelation ( $ contentId , $ versionNumber , $ relationId , Request $ request ) { $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) ; $ relationList = $ this -> repository -> getContentService ( ) -> loadRelations ( $ this -> repository -> getConte...
Loads a relation for the given content object and version .
39,348
public function removeRelation ( $ contentId , $ versionNumber , $ relationId , Request $ request ) { $ versionInfo = $ this -> repository -> getContentService ( ) -> loadVersionInfo ( $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) , $ versionNumber ) ; $ versionRelations = $ this -> r...
Deletes a relation of the given draft .
39,349
public function createRelation ( $ contentId , $ versionNumber , Request $ request ) { $ destinationContentId = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; $ contentInfo = $ this -> repository -> getCon...
Creates a new relation of type COMMON for the given draft .
39,350
private function getTranslatedMessage ( Exception $ exception ) { $ message = $ exception -> getMessage ( ) ; if ( $ exception instanceof Translatable ) { $ message = $ this -> translator -> trans ( $ exception -> getMessageTemplate ( ) , $ exception -> getParameters ( ) , 'repository_exceptions' ) ; } return $ message...
Translates the exception message if it is translatable .
39,351
public function createContentDraft ( $ parentLocationId , $ contentTypeIdentifier , $ fields , $ languageCode = null ) { $ languageCode = $ languageCode ? : self :: DEFAULT_LANGUAGE ; $ repository = $ this -> getRepository ( ) ; $ locationCreateStruct = $ repository -> getLocationService ( ) -> newLocationCreateStruct ...
Creates a content draft .
39,352
public function createContentWithPath ( $ path , $ fields , $ contentType ) { $ contentsName = explode ( '/' , $ path ) ; $ currentPath = '' ; $ location = '2' ; foreach ( $ contentsName as $ name ) { if ( $ name != end ( $ contentsName ) ) { $ location = $ this -> createContent ( 'folder' , [ 'name' => $ name ] , $ lo...
Creates and publishes a content at a given path . Non - existing path items are created as folders named after the path element .
39,353
private function mapContentPath ( $ path ) { $ contentNames = explode ( '/' , $ path ) ; $ this -> contentPaths [ end ( $ contentNames ) ] = $ path ; }
Maps the path of the content to it s name for later use .
39,354
private function doEvaluate ( APILimitationValue $ value , array $ targets ) : bool { foreach ( $ targets as $ target ) { if ( ! $ target instanceof Section && ! $ target instanceof SPISection ) { throw new InvalidArgumentException ( '$targets' , 'Must contain objects of type: Section' ) ; } if ( ! in_array ( $ target ...
Returns true if given limitation value allows all given sections .
39,355
protected function backupCustomLocationAliases ( ) { $ table = static :: CUSTOM_ALIAS_BACKUP_TABLE ; if ( ! $ this -> tableExists ( $ table ) ) { $ this -> createCustomLocationUrlAliasBackupTable ( ) ; } if ( ! $ this -> isTableEmpty ( $ table ) ) { throw new RuntimeException ( "Table '{$table}' contains data. " . "Ens...
Backups custom Location URL aliases the custom URL alias backup table .
39,356
protected function doBackupCustomLocationAliases ( ) { $ totalCount = $ this -> getTotalLocationCount ( ) ; $ passCount = ceil ( $ totalCount / $ this -> bulkCount ) ; $ customAliasCount = 0 ; $ customAliasPathCount = 0 ; if ( $ totalCount === 0 ) { $ this -> output -> writeln ( 'Could not find any Locations, nothing t...
Internal method for backing up custom Location URL aliases .
39,357
protected function combinePaths ( array $ pathData ) { $ paths = [ ] ; $ levelData = array_shift ( $ pathData ) ; $ levelElements = $ this -> extractPathElements ( $ levelData ) ; if ( ! empty ( $ pathData ) ) { $ nextElements = $ this -> combinePaths ( $ pathData ) ; foreach ( $ levelElements as $ element1 ) { foreach...
Combines path data to an array of URL alias paths .
39,358
protected function generateLocationAliases ( ) { $ tableName = static :: MIGRATION_TABLE ; if ( ! $ this -> tableExists ( $ tableName ) ) { throw new RuntimeException ( "Could not find main URL alias migration table '{$tableName}'. " . 'Ensure that table exists (you will have to create it manually).' ) ; } if ( ! $ thi...
Generates URL aliases from the Location and Content data to the migration table .
39,359
protected function doGenerateLocationAliases ( ) { $ totalLocationCount = $ this -> getTotalLocationCount ( ) ; $ totalContentCount = $ this -> getTotalLocationContentCount ( ) ; $ passCount = ceil ( $ totalLocationCount / $ this -> bulkCount ) ; $ publishedAliasCount = 0 ; if ( $ totalLocationCount === 0 ) { $ this ->...
Internal method for generating URL aliases .
39,360
protected function backupGlobalAliases ( ) { $ table = static :: GLOBAL_ALIAS_BACKUP_TABLE ; if ( ! $ this -> tableExists ( $ table ) ) { $ this -> createGlobalUrlAliasBackupTable ( ) ; } if ( ! $ this -> isTableEmpty ( $ table ) ) { throw new RuntimeException ( "Table '{$table}' contains data. " . "Ensure it's empty o...
Backups global URL aliases the custom URL alias backup table .
39,361
protected function doBackupGlobalAliases ( ) { $ aliases = $ this -> urlAliasHandler -> listGlobalURLAliases ( ) ; $ totalCount = count ( $ aliases ) ; $ pathCount = 0 ; if ( $ totalCount === 0 ) { $ this -> output -> writeln ( 'Could not find any global URL aliases, nothing to backup.' ) ; $ this -> output -> writeln ...
Internal method for backing up global URL aliases .
39,362
protected function restoreGlobalAliases ( ) { $ table = static :: MIGRATION_TABLE ; $ backupTable = static :: GLOBAL_ALIAS_BACKUP_TABLE ; if ( ! $ this -> tableExists ( $ table ) ) { throw new RuntimeException ( "Could not find main URL alias migration table '{$table}'. " . 'Ensure that table exists (you will have to c...
Restores global URL aliases from the backup table .
39,363
protected function publishAliases ( $ locationId , $ parentLocationId , $ contentId ) { $ content = $ this -> contentService -> loadContent ( $ contentId ) ; $ urlAliasNames = $ this -> nameSchemaResolver -> resolveUrlAliasSchema ( $ content ) ; foreach ( $ urlAliasNames as $ languageCode => $ name ) { try { $ this -> ...
Publishes URL aliases in all languages for the given parameters .
39,364
protected function getTotalLocationCount ( ) { $ platform = $ this -> connection -> getDatabasePlatform ( ) ; $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ queryBuilder -> select ( $ platform -> getCountExpression ( 'node_id' ) ) -> from ( 'ezcontentobject_tree' ) -> where ( $ queryBuilder -> expr...
Returns total number of Locations in the database .
39,365
protected function createCustomLocationUrlAliasBackupTable ( ) { $ schema = new Schema ( ) ; $ table = $ schema -> createTable ( static :: CUSTOM_ALIAS_BACKUP_TABLE ) ; $ table -> addColumn ( 'id' , 'integer' , [ 'autoincrement' => true ] ) ; $ table -> addColumn ( 'location_id' , 'integer' ) ; $ table -> addColumn ( '...
Creates database table for custom Location URL alias backup .
39,366
protected function createGlobalUrlAliasBackupTable ( ) { $ schema = new Schema ( ) ; $ table = $ schema -> createTable ( static :: GLOBAL_ALIAS_BACKUP_TABLE ) ; $ table -> addColumn ( 'id' , 'integer' , [ 'autoincrement' => true ] ) ; $ table -> addColumn ( 'resource' , 'text' ) ; $ table -> addColumn ( 'path' , 'text'...
Creates database table for custom URL alias backup .
39,367
protected function getProgressBar ( $ maxSteps ) { $ progressBar = new ProgressBar ( $ this -> output , $ maxSteps ) ; $ progressBar -> setFormat ( ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%' ) ; return $ progressBar ; }
Returns configured progress bar helper .
39,368
public function isDynamicSetting ( $ setting ) { if ( parent :: isDynamicSetting ( $ setting ) === false ) { return false ; } return ( bool ) preg_match ( '/^' . $ this -> dynamicSettingRegex . '$/' , $ setting ) ; }
In addition to the parent s test verifies the variables with a regexp .
39,369
public function parseTranslatableList ( array $ listElement ) { $ listItems = array ( ) ; foreach ( $ listElement [ 'value' ] as $ valueRow ) { $ listItems [ $ valueRow [ '_languageCode' ] ] = isset ( $ valueRow [ '#text' ] ) ? $ valueRow [ '#text' ] : '' ; } return $ listItems ; }
Parses a translatable list like names or descriptions .
39,370
public function parseLimitation ( array $ limitation ) { if ( ! array_key_exists ( '_identifier' , $ limitation ) ) { throw new Exceptions \ Parser ( "Missing '_identifier' attribute for Limitation." ) ; } $ limitationObject = $ this -> getLimitationByIdentifier ( $ limitation [ '_identifier' ] ) ; if ( ! isset ( $ lim...
Parses the input structure to Limitation object .
39,371
public function listSections ( Request $ request ) { if ( $ request -> query -> has ( 'identifier' ) ) { $ sections = array ( $ this -> loadSectionByIdentifier ( $ request ) , ) ; } else { $ sections = $ this -> sectionService -> loadSections ( ) ; } return new Values \ SectionList ( $ sections , $ request -> getPathIn...
List sections .
39,372
public function createSection ( Request $ request ) { try { $ createdSection = $ this -> sectionService -> createSection ( $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ) ; } catch ( InvalidArgumentExceptio...
Create new section .
39,373
public function updateSection ( $ sectionId , Request $ request ) { $ createStruct = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ request -> getContent ( ) ) ) ; try { return $ this -> sectionService -> updateSection ( $ this -> sectio...
Updates a section .
39,374
public function deleteSection ( $ sectionId ) { $ this -> sectionService -> deleteSection ( $ this -> sectionService -> loadSection ( $ sectionId ) ) ; return new NoContent ( ) ; }
Delete a section by ID .
39,375
protected function getContentDbFieldsStmt ( array $ fields ) { $ query = $ this -> databaseHandler -> createSelectQuery ( ) ; $ query -> select ( $ fields ) -> from ( $ this -> databaseHandler -> quoteTable ( self :: CONTENTOBJECT_TABLE ) ) -> where ( $ query -> expr -> eq ( 'status' , ContentInfo :: STATUS_PUBLISHED )...
Get PDOStatement to fetch metadata about content objects to be indexed .
39,376
protected function getContentLocationIds ( $ contentObjectId ) { $ query = $ this -> databaseHandler -> createSelectQuery ( ) ; $ query -> select ( 'node_id' ) -> from ( $ this -> databaseHandler -> quoteTable ( self :: CONTENTOBJECT_TREE_TABLE ) ) -> where ( $ query -> expr -> eq ( 'contentobject_id' , $ contentObject...
Fetch location Ids for the given content object .
39,377
public function loadContentByContentInfo ( ContentInfo $ contentInfo , array $ languages = null , $ versionNo = null , $ useAlwaysAvailable = true ) { return $ this -> service -> loadContentByContentInfo ( $ contentInfo , $ languages , $ versionNo , $ useAlwaysAvailable ) ; }
Loads content in a version for the given content info object .
39,378
public function translateVersion ( TranslationInfo $ translationInfo , TranslationValues $ translationValues , User $ user = null ) { $ returnValue = $ this -> service -> translateVersion ( $ translationInfo , $ translationValues , $ user ) ; $ this -> signalDispatcher -> emit ( new TranslateVersionSignal ( array ( 'co...
Translate a version .
39,379
public function addTranslationInfo ( TranslationInfo $ translationInfo ) { $ returnValue = $ this -> service -> addTranslationInfo ( $ translationInfo ) ; $ this -> signalDispatcher -> emit ( new AddTranslationInfoSignal ( array ( ) ) ) ; return $ returnValue ; }
Adds translation information to the content object .
39,380
public function convert ( DOMDocument $ document ) { $ xpath = new DOMXPath ( $ document ) ; $ xpath -> registerNamespace ( 'docbook' , 'http://docbook.org/ns/docbook' ) ; $ xpathExpression = '//docbook:eztemplate | //docbook:eztemplateinline' ; $ templates = $ xpath -> query ( $ xpathExpression ) ; $ templatesSorted =...
Injects rendered payloads into template elements .
39,381
protected function buildDomainObject ( SPIUrl $ data ) { return new URL ( [ 'id' => $ data -> id , 'url' => $ data -> url , 'isValid' => $ data -> isValid , 'lastChecked' => $ this -> createDateTime ( $ data -> lastChecked ) , 'created' => $ this -> createDateTime ( $ data -> created ) , 'modified' => $ this -> createD...
Builds domain object from ValueObject returned by Persistence API .
39,382
protected function buildUpdateStruct ( URL $ url , URLUpdateStruct $ data ) { $ updateStruct = new SPIUrlUpdateStruct ( ) ; if ( $ data -> url !== null && $ url -> url !== $ data -> url ) { $ updateStruct -> url = $ data -> url ; $ updateStruct -> lastChecked = 0 ; $ updateStruct -> isValid = true ; } else { $ updateSt...
Builds SPI update structure used by Persistence API .
39,383
protected function isUnique ( $ id , $ url ) { try { return $ this -> loadByUrl ( $ url ) -> id === $ id ; } catch ( NotFoundException $ e ) { return true ; } }
Check if URL is unique .
39,384
public function parse ( array $ data , ParsingDispatcher $ parsingDispatcher ) { $ query = $ this -> buildQuery ( ) ; if ( array_key_exists ( 'Criteria' , $ data ) && is_array ( $ data [ 'Criteria' ] ) ) { $ message = 'The Criteria element is deprecated since ezpublish-kernel 6.6, and will be removed in 8.0. Use Filter...
Parses input structure to a Query .
39,385
private function processSortClauses ( array $ sortClausesArray , ParsingDispatcher $ parsingDispatcher ) { $ sortClauses = [ ] ; foreach ( $ sortClausesArray as $ sortClauseName => $ sortClauseData ) { if ( ! is_array ( $ sortClauseData ) || ! isset ( $ sortClauseData [ 0 ] ) ) { $ sortClauseData = [ $ sortClauseData ]...
Handles SortClause data .
39,386
private function createExpression ( array $ dynamicSetting ) { $ expression = sprintf ( 'service("ezpublish.config.resolver").getParameter("%s", %s, %s)' , $ dynamicSetting [ 'param' ] , isset ( $ dynamicSetting [ 'namespace' ] ) ? '"' . $ dynamicSetting [ 'namespace' ] . '"' : 'null' , isset ( $ dynamicSetting [ 'scop...
Returns the expression object corresponding to passed dynamic setting .
39,387
public function loadRoleDraft ( $ id ) { if ( $ this -> repository -> hasAccess ( 'role' , 'read' ) !== true ) { throw new UnauthorizedException ( 'role' , 'read' ) ; } $ spiRole = $ this -> userHandler -> loadRole ( $ id , Role :: STATUS_DRAFT ) ; return $ this -> roleDomainMapper -> buildDomainRoleDraftObject ( $ spi...
Loads a RoleDraft for the given id .
39,388
public function loadRoleDraftByRoleId ( $ roleId ) { if ( $ this -> repository -> hasAccess ( 'role' , 'read' ) !== true ) { throw new UnauthorizedException ( 'role' , 'read' ) ; } $ spiRole = $ this -> userHandler -> loadRoleDraftByRoleId ( $ roleId ) ; return $ this -> roleDomainMapper -> buildDomainRoleDraftObject (...
Loads a RoleDraft by the ID of the role it was created from .
39,389
public function updateRoleDraft ( APIRoleDraft $ roleDraft , RoleUpdateStruct $ roleUpdateStruct ) { if ( $ roleUpdateStruct -> identifier !== null && ! is_string ( $ roleUpdateStruct -> identifier ) ) { throw new InvalidArgumentValue ( 'identifier' , $ roleUpdateStruct -> identifier , 'RoleUpdateStruct' ) ; } $ loaded...
Updates the properties of a RoleDraft .
39,390
public function addPolicyByRoleDraft ( APIRoleDraft $ roleDraft , APIPolicyCreateStruct $ policyCreateStruct ) { if ( ! is_string ( $ policyCreateStruct -> module ) || empty ( $ policyCreateStruct -> module ) ) { throw new InvalidArgumentValue ( 'module' , $ policyCreateStruct -> module , 'PolicyCreateStruct' ) ; } if ...
Adds a new policy to the RoleDraft .
39,391
public function removePolicyByRoleDraft ( APIRoleDraft $ roleDraft , PolicyDraft $ policyDraft ) { if ( $ this -> repository -> hasAccess ( 'role' , 'update' ) !== true ) { throw new UnauthorizedException ( 'role' , 'update' ) ; } if ( $ policyDraft -> roleId != $ roleDraft -> id ) { throw new InvalidArgumentException ...
Removes a policy from a RoleDraft .
39,392
public function deleteRoleDraft ( APIRoleDraft $ roleDraft ) { $ loadedRoleDraft = $ this -> loadRoleDraft ( $ roleDraft -> id ) ; $ this -> repository -> beginTransaction ( ) ; try { $ this -> userHandler -> deleteRole ( $ loadedRoleDraft -> id , Role :: STATUS_DRAFT ) ; $ this -> repository -> commit ( ) ; } catch ( ...
Deletes the given RoleDraft .
39,393
public function publishRoleDraft ( APIRoleDraft $ roleDraft ) { if ( $ this -> repository -> hasAccess ( 'role' , 'update' ) !== true ) { throw new UnauthorizedException ( 'role' , 'update' ) ; } try { $ loadedRoleDraft = $ this -> loadRoleDraft ( $ roleDraft -> id ) ; } catch ( APINotFoundException $ e ) { throw new B...
Publishes a given RoleDraft .
39,394
public function loadRoleByIdentifier ( $ identifier ) { if ( ! is_string ( $ identifier ) ) { throw new InvalidArgumentValue ( 'identifier' , $ identifier ) ; } if ( $ this -> repository -> hasAccess ( 'role' , 'read' ) !== true ) { throw new UnauthorizedException ( 'role' , 'read' ) ; } $ spiRole = $ this -> userHandl...
Loads a role for the given identifier .
39,395
public function loadRoleAssignment ( $ roleAssignmentId ) { if ( $ this -> repository -> hasAccess ( 'role' , 'read' ) !== true ) { throw new UnauthorizedException ( 'role' , 'read' ) ; } $ spiRoleAssignment = $ this -> userHandler -> loadRoleAssignment ( $ roleAssignmentId ) ; $ userService = $ this -> repository -> g...
Loads a role assignment for the given id .
39,396
public function getRoleAssignments ( APIRole $ role ) { if ( $ this -> repository -> hasAccess ( 'role' , 'read' ) !== true ) { throw new UnauthorizedException ( 'role' , 'read' ) ; } $ userService = $ this -> repository -> getUserService ( ) ; $ spiRoleAssignments = $ this -> userHandler -> loadRoleAssignmentsByRoleId...
Returns the assigned user and user groups to this role .
39,397
protected function validateRoleCreateStruct ( APIRoleCreateStruct $ roleCreateStruct ) { $ allErrors = array ( ) ; foreach ( $ roleCreateStruct -> getPolicies ( ) as $ key => $ policyCreateStruct ) { $ errors = $ this -> validatePolicy ( $ policyCreateStruct -> module , $ policyCreateStruct -> function , $ policyCreate...
Validates Policies and Limitations in Role create struct .
39,398
protected function checkAssignmentAndFilterLimitationValues ( $ contentId , SPIRole $ spiRole , array $ limitation = null ) { $ spiRoleAssignments = $ this -> userHandler -> loadRoleAssignmentsByGroupId ( $ contentId ) ; foreach ( $ spiRoleAssignments as $ spiAssignment ) { if ( $ spiAssignment -> roleId !== $ spiRole ...
Validate that assignments not already exists and filter validations against existing .
39,399
private function createComplexSettingExpression ( $ argumentValue , array $ dynamicSettings ) { $ resolverArguments = [ '"' . $ argumentValue . '"' ] ; foreach ( $ dynamicSettings as $ dynamicSetting ) { $ resolverArguments [ ] = '"' . trim ( $ dynamicSetting , '$' ) . '"' ; $ resolverArguments [ ] = $ this -> createCo...
Creates an expression for given complex setting .